Documentation
¶
Index ¶
- Constants
- func ProcessMethod(ctx context.Context, id jsonrpc.RequestId, method string, ...) (any, error)
- type Annotated
- type CallToolRequest
- type CallToolResult
- type Cursor
- type EmptyResult
- type ListToolsRequest
- type ListToolsResult
- type PaginatedRequest
- type PaginatedResult
- type Role
- type TextContent
- type ToolAnnotations
Constants ¶
const ( PING = "ping" TOOLS_LIST = "tools/list" TOOLS_CALL = "tools/call" )
methods that are supported.
const PROTOCOL_VERSION = "2025-06-18"
PROTOCOL_VERSION is the version of the MCP protocol in this package.
const SERVER_NAME = "Toolbox"
SERVER_NAME is the server name used in Implementation.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Annotated ¶
type Annotated struct {
Annotations *struct {
// Describes who the intended customer of this object or data is.
// It can include multiple entries to indicate content useful for multiple
// audiences (e.g., `["user", "assistant"]`).
Audience []Role `json:"audience,omitempty"`
// Describes how important this data is for operating the server.
//
// A value of 1 means "most important," and indicates that the data is
// effectively required, while 0 means "least important," and indicates that
// the data is entirely optional.
//
// @TJS-type number
// @minimum 0
// @maximum 1
Priority float64 `json:"priority,omitempty"`
} `json:"annotations,omitempty"`
}
Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed
type CallToolRequest ¶
type CallToolRequest struct {
jsonrpc.Request
Params struct {
Name string `json:"name"`
Arguments map[string]any `json:"arguments,omitempty"`
} `json:"params,omitempty"`
}
Used by the client to invoke a tool provided by the server.
type CallToolResult ¶
type CallToolResult struct {
jsonrpc.Result
// Could be either a TextContent, ImageContent, or EmbeddedResources
// For Toolbox, we will only be sending TextContent
Content []TextContent `json:"content"`
// Whether the tool call ended in an error.
// If not set, this is assumed to be false (the call was successful).
//
// Any errors that originate from the tool SHOULD be reported inside the result
// object, with `isError` set to true, _not_ as an MCP protocol-level error
// response. Otherwise, the LLM would not be able to see that an error occurred
// and self-correct.
//
// However, any errors in _finding_ the tool, an error indicating that the
// server does not support tool calls, or any other exceptional conditions,
// should be reported as an MCP error response.
IsError bool `json:"isError,omitempty"`
// An optional JSON object that represents the structured result of the tool call.
StructuredContent map[string]any `json:"structuredContent,omitempty"`
}
The server's response to a tool call.
Any errors that originate from the tool SHOULD be reported inside the result object, with `isError` set to true, _not_ as an MCP protocol-level error response. Otherwise, the LLM would not be able to see that an error occurred and self-correct.
However, any errors in _finding_ the tool, an error indicating that the server does not support tool calls, or any other exceptional conditions, should be reported as an MCP error response.
type Cursor ¶
type Cursor string
Cursor is an opaque token used to represent a cursor for pagination.
type EmptyResult ¶
EmptyResult represents a response that indicates success but carries no data.
type ListToolsRequest ¶
type ListToolsRequest struct {
PaginatedRequest
}
Sent from the client to request a list of tools the server has.
type ListToolsResult ¶
type ListToolsResult struct {
PaginatedResult
Tools []tools.McpManifest `json:"tools"`
}
The server's response to a tools/list request from the client.
type PaginatedRequest ¶
type PaginatedResult ¶
type TextContent ¶
type TextContent struct {
Annotated
Type string `json:"type"`
// The text content of the message.
Text string `json:"text"`
}
TextContent represents text provided to or from an LLM.
type ToolAnnotations ¶
type ToolAnnotations struct {
// A human-readable title for the tool.
Title string `json:"title,omitempty"`
// If true, the tool does not modify its environment.
// Default: false
ReadOnlyHint bool `json:"readOnlyHint,omitempty"`
// If true, the tool may perform destructive updates to its environment.
// If false, the tool performs only additive updates.
// (This property is meaningful only when `readOnlyHint == false`)
// Default: true
DestructiveHint bool `json:"destructiveHint,omitempty"`
// If true, calling the tool repeatedly with the same arguments
// will have no additional effect on the its environment.
// (This property is meaningful only when `readOnlyHint == false`)
// Default: false
IdempotentHint bool `json:"idempotentHint,omitempty"`
// If true, this tool may interact with an "open world" of external
// entities. If false, the tool's domain of interaction is closed.
// For example, the world of a web search tool is open, whereas that
// of a memory tool is not.
// Default: true
OpenWorldHint bool `json:"openWorldHint,omitempty"`
}
Additional properties describing a Tool to clients.
NOTE: all properties in ToolAnnotations are **hints**. They are not guaranteed to provide a faithful description of tool behavior (including descriptive properties like `title`).
Clients should never make tool use decisions based on ToolAnnotations received from untrusted servers.