Documentation
¶
Overview ¶
Package mcptools is the single registry of gofer's OWN MCP tools (the gofer_* tools internal/mcpserver exposes) and of what each one does to state.
It exists because two very different places need the same answer:
- internal/mcpserver turns every entry into the tool's MCP `annotations` (readOnlyHint / destructiveHint / idempotentHint), so an MCP client can tell a list/get tool from one that writes before it calls either;
- the approval gate (internal/runner/acp) auto-allows a permission request for one of these read-only tools no matter what kind the agent reported, so a steward asking gofer_work_list does not park on a human.
The registry is deliberately here — a leaf package both may import — instead of in internal/mcpserver (an entry-layer package the runner must not depend on). It is a whitelist of exact names, never a name-prefix guess: a tool another MCP server names gofer_work_list is not gofer's, and stays gated.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsReadOnly ¶
IsReadOnly reports whether name is one of gofer's read-only tools.
func ReadOnlyToolName ¶
ReadOnlyToolName reports the gofer read-only tool raw names, if it names one.
func ToolName ¶
ToolName resolves the gofer tool a raw name refers to. raw is either the bare tool name (what suga and most ACP agents put in a tool call's title, e.g. "gofer_work_list") or an MCP-qualified name in the mcp__<server>__<tool> shape ("mcp__gofer__gofer_work_list"). A name qualified by ANOTHER server is not gofer's tool even when the last segment matches, and anything else that looks namespaced is refused rather than guessed: the caller uses this to skip a human approval, so a false positive is the expensive mistake.
Types ¶
type Class ¶
type Class string
Class says how a tool treats state. The three values map onto the MCP annotation hints, and only ReadOnly is ever auto-approved by the approval gate.
const ( // ReadOnly tools list, read, search or compute; they change nothing a caller has // to confirm. ReadOnly Class = "read_only" // Write tools create or change state in an additive way (submit a job, append a // note, send a letter). Write Class = "write" // Destructive tools delete or overwrite stored data (remove a memory, overwrite // one, cancel a job, end a session, withdraw a letter). Destructive Class = "destructive" )
type Tool ¶
type Tool struct {
Name string
Class Class
// Idempotent marks a write that leaves the same state when repeated with the same
// arguments (a "set" rather than an "append"). Read-only tools are always
// idempotent and do not need it.
Idempotent bool
}
Tool is one entry: the tool's exact MCP name and its class.