Documentation
¶
Overview ¶
Package tools provides a thread-safe registry for MCP-compatible tools that agents can invoke during execution. Tools are registered by name and looked up at runtime when an agent's plan includes tool calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateAgainstSchema ¶
func ValidateAgainstSchema(schema json.RawMessage, params json.RawMessage) error
ValidateAgainstSchema validates params against a JSON Schema definition. Returns nil when schema is empty/null or params are valid.
Types ¶
type ArgumentValidator ¶
type ArgumentValidator interface {
ValidateArguments(params json.RawMessage) error
}
ArgumentValidator is an optional interface that tools can implement to provide custom argument validation beyond JSON Schema. The runner first performs automatic JSON Schema validation using InputSchema(), then calls ValidateArguments for tools that implement this interface.
type Tool ¶
type Tool interface {
Name() string
Description() string
InputSchema() json.RawMessage
Execute(ctx context.Context, params json.RawMessage) (json.RawMessage, error)
}
Tool is the interface all MCP-compatible tools must implement.
type ToolRegistry ¶
type ToolRegistry struct {
// contains filtered or unexported fields
}
ToolRegistry manages registered tools for agent execution. Thread-safe for concurrent access.
func (*ToolRegistry) Get ¶
func (r *ToolRegistry) Get(name string) (Tool, bool)
Get returns a tool by name.
func (*ToolRegistry) Register ¶
func (r *ToolRegistry) Register(tool Tool)
Register adds a tool to the registry.