Documentation
¶
Overview ¶
Package tools is Ether's one tool catalogue. The Ask Ether agent and the MCP server both read it; plugin tools join it through the plugin host.
It mirrors AppKit's McpCatalogTool contract (appkit-mcp): a hidden tool is never offered to a model, every tool ends in an existing gated service and never a parallel query path, inputs are re-validated in Execute, every call is audited, and only mapped error messages reach a model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Catalogue ¶
type Catalogue struct {
// contains filtered or unexported fields
}
Catalogue is the set of tools. It is safe for concurrent use.
func (*Catalogue) ReplaceOwner ¶
ReplaceOwner swaps every tool owned by a plugin.
type Link ¶
type Link struct {
Label string `json:"label"` // English source; the console translates it
Route string `json:"route"` // console route, e.g. "/releases/history/42"
}
Link is a console deep link a result may offer.
type Principal ¶
type Principal struct {
ViewerID int64
IsOwner bool
// Surface is "console" for Ask Ether, "mcp" for paired MCP clients.
Surface string
// Scopes holds grant scopes ("read", "full") for MCP; empty for console.
Scopes []string
// Plugin is set when a plugin acts through the catalogue.
Plugin string
}
Principal is the authenticated actor a tool runs as.
type Proposal ¶
type Proposal struct {
// Category is a short English label for the approval card ("Blocklist a release").
Category string `json:"category"`
Description string `json:"description"`
Details []ProposalDetail `json:"details,omitempty"`
// Apply runs the change after approval. It must be idempotent.
Apply func(ctx context.Context) (Result, error) `json:"-"`
// Input is the validated input, stored with the approval for audit.
Input map[string]any `json:"input,omitempty"`
}
Proposal is a write the owner must approve before it runs. Tools that change anything return a Proposal instead of acting.
type ProposalDetail ¶
ProposalDetail is one labelled value shown on an approval card.
type Result ¶
type Result struct {
// Data is sent to the model. Keep it compact and bounded.
Data map[string]any `json:"data,omitempty"`
// Links are offered in the console next to the answer.
Links []Link `json:"links,omitempty"`
Navigate string `json:"navigate,omitempty"`
// Proposal, when set, becomes an approval card; nothing has changed yet.
Proposal *Proposal `json:"proposal,omitempty"`
// Secret, when set, asks the owner for a credential through a secret
// card. The value goes straight to sealed storage through Store and is
// never returned to the tool, the transcript or a model.
Secret *SecretRequest `json:"secret,omitempty"`
}
Result is what a tool returns.
type SecretRequest ¶
type SecretRequest struct {
ProviderLabel string `json:"providerLabel"` // English source, e.g. "Real-Debrid"
CredentialLabel string `json:"credentialLabel"` // English source, e.g. "API token"
Purpose string `json:"purpose"` // English source, one sentence
HelpURL string `json:"helpUrl,omitempty"`
// Store seals the value into its destination. It runs once, after the
// owner submits, and must never log or echo the value.
Store func(ctx context.Context, value string) error `json:"-"`
}
SecretRequest asks the owner for one credential.
type Tool ¶
type Tool struct {
Name string // snake_case; plugin tools are "<plugin>__<name>" with dots as _
Title string // English source, translated in the console
Description string // for the model
InputSchema json.RawMessage // JSON Schema (object); Execute re-validates
ReadOnly bool
Destructive bool
// OpenWorld marks tools that reach external services or return text that
// third parties control (release names, TMDB overviews, plugin output).
OpenWorld bool
Audience Audience
// Owner is "builtin" or a plugin id.
Owner string
// Visible hides a tool from a principal entirely. Nil means visible.
Visible func(ctx context.Context, p Principal) bool
Execute func(ctx context.Context, p Principal, input map[string]any) (Result, error)
Summarize func(Result) string
}
Tool is one catalogue entry.