mcptools

package
v0.188.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

Variables

This section is empty.

Functions

func IsReadOnly

func IsReadOnly(name string) bool

IsReadOnly reports whether name is one of gofer's read-only tools.

func MailReplyToolName added in v0.187.0

func MailReplyToolName(raw string) (string, bool)

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 ReadOnlyToolName

func ReadOnlyToolName(raw string) (string, bool)

ReadOnlyToolName reports the gofer read-only tool raw names, if it names one.

func ToolName

func ToolName(raw string) (string, bool)

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.

func All

func All() []Tool

All returns the registry (a copy of the slice; the entries are values).

func Lookup

func Lookup(name string) (Tool, bool)

Lookup returns the entry for an exact gofer tool name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL