Documentation
¶
Overview ¶
Package toolmcp adapts MCP server tools for use in bond agent loops. It bridges the Model Context Protocol SDK's client session to bond's Tool interface, allowing bond agents to invoke tools hosted on MCP servers.
Package schema provides JSON Schema generation and validation helpers for bond tools. It wraps github.com/google/jsonschema-go/jsonschema to derive schemas from Go types and validate data against them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnforceStructuredOutput ¶
EnforceStructuredOutput wraps a Tool so that its output is validated against the JSON Schema derived from Out. If the tool's output doesn't conform to the schema, Run returns an error.
Example:
wrapped := schema.EnforceStructuredOutput[MyOutput](baseTool)
Types ¶
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema wraps a generated JSON Schema and implements json.Marshaler.
func SchemaFor ¶
For derives a JSON Schema from the Go type T using struct tags (json, jsonschema). Returns a Schema suitable for use as bond.FuncToolOptions.InputSchema or OutputSchema.
Example:
type AddInput struct {
A int `json:"a" jsonschema:"first number"`
B int `json:"b" jsonschema:"second number"`
}
schema.For[AddInput]() // returns json.Marshaler with the derived schema
func (Schema) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
type Session ¶
type Session interface {
ListTools(ctx context.Context, params *mcp.ListToolsParams) (*mcp.ListToolsResult, error)
CallTool(ctx context.Context, params *mcp.CallToolParams) (*mcp.CallToolResult, error)
}
Session defines the subset of *mcp.ClientSession used by this package. Allows mocking in tests.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package builtin provides a suite of reusable tools for Bond agents that cover common system interactions: shell command execution, HTTP fetching, file I/O, and environment variable access.
|
Package builtin provides a suite of reusable tools for Bond agents that cover common system interactions: shell command execution, HTTP fetching, file I/O, and environment variable access. |
|
Package registry provides a plugin that exposes a large collection of tools through a stable 3-tool gateway: list_tools, describe_tool, use_tool.
|
Package registry provides a plugin that exposes a large collection of tools through a stable 3-tool gateway: list_tools, describe_tool, use_tool. |