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 ¶
const MailReplyTool = "gofer_session_mail_reply"
MailReplyTool is the mailbox's answer tool. It is a Write tool, but the resident 收件会话 may call it without a human (gofer-sh7r): answering a letter that arrived in this session is the whole job. Callers still gate every other gofer write tool.
const ServerName = "gofer"
ServerName is the name gofer's own MCP server is advertised under when gofer injects it (the steward's and a resident 收件会话's session both get exactly this name). It is the canonical server segment of an MCP-qualified tool name, and the approval gate takes gofer's tool names only from it (or from a name this server itself advertised for the same gofer binary) — never from any other MCP server's namespace.
Variables ¶
This section is empty.
Functions ¶
func AutoApprovedTools ¶ added in v0.193.0
func AutoApprovedTools() []string
AutoApprovedTools returns the exact names of the tools the approval gate may run without a human by DEFAULT under mode=ask (config.DefaultApprovalAutoAllowTools): every read-only tool, then every advisory one, in registry order. The list is data, not a prefix rule — a tool another MCP server names the same way is never included.
func BaseName ¶ added in v0.193.0
BaseName returns the tool segment of a raw or mcp__<server>__<tool> name, lowercased and unquoted ("gofer_work_list" for both "gofer_work_list" and "mcp__other__gofer_work_list"). It deliberately does NOT say whether the name is gofer's: config's tool lists are matched through it for tools of ANY MCP server.
func IsAdvisory ¶ added in v0.193.0
IsAdvisory reports whether name is one of gofer's advice-only write tools.
func IsReadOnly ¶
IsReadOnly reports whether name is one of gofer's read-only tools.
func MailReplyToolName ¶ added in v0.187.0
MailReplyToolName reports the gofer mailbox reply tool raw names, if it names one. It uses the same exact-name resolution as ToolName, so a tool qualified by another MCP server (or a name that only looks like it) is not gofer's and stays gated.
func ServerOf ¶ added in v0.193.0
ServerOf returns the server segment of an mcp__<server>__<tool> name ("gofer" for "mcp__gofer__gofer_work_list"). ok is false for a bare name and for any other namespacing scheme, which is what lets a caller tell "the agent said this is gofer's tool" from "the agent sent a bare name gofer cannot attribute".
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
// Advisory marks a WRITE that only records a suggestion for a person to accept or
// ignore (gofer_today_advise, gofer_work_merge_suggest, gofer_memory_suggest). It is
// still a Write — it stores a row — but it changes no state a caller has to confirm
// and executes nothing, so the approval gate may run it without a human.
Advisory bool
}
Tool is one entry: the tool's exact MCP name and its class.