Documentation
¶
Overview ¶
Package tools is the godemode-style tool registry. The same registry backs both surfaces of git-mem: the native MCP tools (tools/list, tools/call) and the "code mode" run tool, where interpreted Go calls registry.Call(...).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallEvent ¶
type CallEvent struct {
Name string `json:"name"`
Args map[string]interface{} `json:"args"`
Result interface{} `json:"result,omitempty"`
Err string `json:"error,omitempty"`
Duration time.Duration `json:"duration_ns"`
At time.Time `json:"at"`
}
CallEvent is one observed tool invocation. Every Call — whether it arrives via the native MCP tools/call handler, the code-mode interpreter, or the web UI — flows through Registry.Call, so a single observer sees the complete activity trail. Err is nil on success.
type Param ¶
type Param struct {
Name string
Type string // "string" | "number" | "boolean" | "object" | "array"
Description string
Required bool
}
Param describes one argument of a tool, used to build MCP JSON schemas and the prompt-time documentation handed to the agent.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps tool names to tools. Safe for concurrent use.
func (*Registry) Call ¶
func (r *Registry) Call(ctx context.Context, name string, args map[string]interface{}) (interface{}, error)
Call invokes a tool by name. This is the single execution path shared by the MCP tools/call handler and the code-mode interpreter facade.
func (*Registry) Observe ¶
Observe registers a single callback invoked after every Call completes. It is used by the web UI to record an activity/audit trail across MCP, code mode, and direct API calls. Passing nil disables observation. The callback runs synchronously on the calling goroutine, so it must not block.