Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterTools ¶
func RegisterTools(ctx context.Context, registry Registry, client Client, options RegisterOptions) ([]tools.Spec, error)
RegisterTools lists MCP tools once and registers goagent tool adapters for each descriptor. Hosts can refresh by calling it again with their own registry lifecycle policy.
Types ¶
type Client ¶
type Client interface {
ListTools(context.Context) ([]ToolDescriptor, error)
CallTool(ctx context.Context, name string, arguments json.RawMessage) (*ToolCallResult, error)
}
Client is the host-provided boundary to an MCP implementation. mcpkit does not own stdio, HTTP, authorization, or JSON-RPC lifecycle handling.
type ContentPart ¶
type RegisterOptions ¶
type RegisterOptions struct {
Permission policy.Permission
ExecutionMode ports.ExecutionMode
Timeout time.Duration
MaxLLMChars int
// TrustServerAnnotations must be set only after host-side server verification.
// Untrusted MCP annotations are hints, never an authorization source.
TrustServerAnnotations bool
}
RegisterOptions controls how MCP descriptors become goagent tool specs.
type Tool ¶
type Tool struct {
Client Client
Descriptor ToolDescriptor
Options RegisterOptions
}
type ToolAnnotations ¶
type ToolAnnotations struct {
ReadOnlyHint bool `json:"readOnlyHint,omitempty"`
DestructiveHint bool `json:"destructiveHint,omitempty"`
IdempotentHint bool `json:"idempotentHint,omitempty"`
OpenWorldHint bool `json:"openWorldHint,omitempty"`
}
ToolAnnotations follows MCP-style safety hints. Unknown tools remain permissionless so goagent policy denies them unless the host opts in.
type ToolCallResult ¶
type ToolCallResult struct {
Content []ContentPart `json:"content,omitempty"`
StructuredContent json.RawMessage `json:"structuredContent,omitempty"`
IsError bool `json:"isError,omitempty"`
Ref string `json:"ref,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
ToolCallResult is a transport-neutral MCP tool result. Content is projected separately for model-visible and user-visible goagent tool fields.
type ToolDescriptor ¶
type ToolDescriptor struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema json.RawMessage `json:"inputSchema,omitempty"`
Annotations ToolAnnotations `json:"annotations,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
ToolDescriptor is the subset of an MCP tool descriptor needed to expose the tool through goagent. Transport and session fields intentionally stay out.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples/goagent-mcp-http
command
|
|
|
examples/http-smoke
command
|
|
|
examples/stdio-smoke
command
|