Documentation
¶
Overview ¶
Implements an MCP server based on the following specification: https://modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle
Index ¶
Constants ¶
View Source
const ( RPCVersion = "2.0" ProtocolVersion = "2025-06-18" // Message types MessageTypeInitialize = "initialize" MessageTypePing = "ping" MessageTypeListTools = "tools/list" MessageTypeCallTool = "tools/call" MessageTypeListResources = "resources/list" MessageTypeListPrompts = "prompts/list" // Notification types NotificationTypeInitialize = "notifications/initialized" // Error codes ErrorCodeMethodNotFound = -32601 ErrorCodeInvalidParameters = -32602 ErrorInternalError = -32603 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Content ¶
type Content struct {
Type string `json:"type"` // "text", "image", "audio", "resource_link", "resource"
Text string `json:"text,omitempty"`
Data string `json:"data,omitempty"`
MimeType string `json:"mimeType,omitempty"`
URI string `json:"uri,omitempty"`
Name string `json:"name,omitempty"`
Resource any `json:"resource,omitempty"`
}
Content represents a single piece of content in a tool result
type Error ¶
type Request ¶
type Request struct {
Version string `json:"jsonrpc"`
Method string `json:"method"`
ID any `json:"id,omitempty"` // string or number for non-notifications
Payload json.RawMessage `json:"params,omitempty"`
}
type RequestList ¶
type RequestList struct {
Cursor string `json:"cursor,omitempty"`
}
type RequestToolCall ¶
type ResponseInitialize ¶
type ResponseInitialize struct {
Capabilities struct {
Prompts map[string]any `json:"prompts"`
Tools map[string]any `json:"tools"`
Resources map[string]any `json:"resources"`
} `json:"capabilities"`
ServerInfo struct {
Name string `json:"name"`
Version string `json:"version"`
} `json:"serverInfo"`
Version string `json:"protocolVersion"`
}
type ResponseListPrompts ¶
type ResponseListResources ¶
type ResponseListTools ¶
type ResponseToolCall ¶
Click to show internal directories.
Click to hide internal directories.