Documentation
¶
Index ¶
- Constants
- type ClientCapabilities
- type ClientInfo
- type ElicitationCapability
- type InitializeRequest
- type InitializeResponse
- type InitializedNotification
- type InputSchema
- type Items
- type JSONRPCError
- type JSONRPCNotification
- type JSONRPCRequest
- type JSONRPCResponse
- type Prompt
- type PromptArgument
- type PromptContent
- type PromptListChangedNotification
- type PromptMessage
- type PromptsCapability
- type PromptsGetRequest
- type PromptsGetResponse
- type PromptsListResponse
- type Property
- type Resource
- type ResourceContent
- type ResourceListChangedNotification
- type ResourcesCapability
- type ResourcesListResponse
- type ResourcesReadRequest
- type ResourcesReadResponse
- type ResourcesSubscribeRequest
- type ResourcesSubscribeResponse
- type ResourcesUnsubscribeRequest
- type ResourcesUnsubscribeResponse
- type RootsCapability
- type SamplingCapability
- type ServerCapabilities
- type ServerInfo
- type Tool
- type ToolContent
- type ToolListChangedNotification
- type ToolsCallRequest
- type ToolsCallResponse
- type ToolsCapability
- type ToolsListResponse
Constants ¶
const ( ParseError = -32700 InvalidRequest = -32600 MethodNotFound = -32601 InvalidParams = -32602 InternalError = -32603 )
Standard JSON-RPC error codes
const ( ConnectionClosed = -1 RequestCancelled = -2 ServerNotReady = -3 )
MCP-specific error codes (per spec)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientCapabilities ¶
type ClientCapabilities struct {
Sampling *SamplingCapability `json:"sampling,omitempty"`
Roots *RootsCapability `json:"roots,omitempty"`
Elicitation *ElicitationCapability `json:"elicitation,omitempty"`
}
type ClientInfo ¶
type ElicitationCapability ¶
type ElicitationCapability struct{} // Placeholder, not used in Phase 1
type InitializeRequest ¶
type InitializeRequest struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities ClientCapabilities `json:"capabilities"`
ClientInfo ClientInfo `json:"clientInfo"`
}
Initialize Request (client → server)
type InitializeResponse ¶
type InitializeResponse struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities ServerCapabilities `json:"capabilities"`
ServerInfo ServerInfo `json:"serverInfo"`
}
Initialize Response (server → client)
type InitializedNotification ¶
type InitializedNotification struct {
}
Initialized Notification (client → server)
type InputSchema ¶
type InputSchema struct {
Type string `json:"type"`
Properties map[string]Property `json:"properties"`
Required []string `json:"required,omitempty"`
}
InputSchema defines the JSON Schema for tool parameters
type Items ¶
type Items struct {
Type string `json:"type"`
}
Items defines the type of array elements
type JSONRPCError ¶
type JSONRPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
JSON-RPC 2.0 Error
type JSONRPCNotification ¶
type JSONRPCNotification struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
JSON-RPC 2.0 Notification (no ID, no response expected)
type JSONRPCRequest ¶
type JSONRPCRequest struct {
JSONRPC string `json:"jsonrpc"` // Must be "2.0"
ID any `json:"id"` // string, number, or null
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
JSON-RPC 2.0 Request
type JSONRPCResponse ¶
type JSONRPCResponse struct {
JSONRPC string `json:"jsonrpc"` // Must be "2.0"
ID any `json:"id"`
Result json.RawMessage `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
JSON-RPC 2.0 Response
type Prompt ¶ added in v0.12.0
type Prompt struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Arguments []PromptArgument `json:"arguments,omitempty"`
}
Prompt represents a pre-configured message template
type PromptArgument ¶ added in v0.12.0
type PromptArgument struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
}
PromptArgument defines an input parameter for a prompt
type PromptContent ¶ added in v0.12.0
type PromptContent struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Data string `json:"data,omitempty"` // Base64 image data
MimeType string `json:"mimeType,omitempty"` // For image or resource content
Resource *struct {
URI string `json:"uri"`
MimeType string `json:"mimeType,omitempty"`
Text string `json:"text,omitempty"`
Blob string `json:"blob,omitempty"`
} `json:"resource,omitempty"` // For embedded resource content
}
PromptContent represents the content of a prompt message This is a union type that can be text, image, or embedded resource
type PromptListChangedNotification ¶ added in v0.12.0
type PromptListChangedNotification struct {
}
PromptListChangedNotification is sent when the list of available prompts changes This is a server-initiated notification sent to clients
type PromptMessage ¶ added in v0.12.0
type PromptMessage struct {
Role string `json:"role"`
Content PromptContent `json:"content"`
}
PromptMessage represents a message in the prompt result
type PromptsCapability ¶
type PromptsCapability struct {
ListChanged bool `json:"listChanged,omitempty"` // Phase 5
}
type PromptsGetRequest ¶ added in v0.12.0
type PromptsGetRequest struct {
Name string `json:"name"`
Arguments map[string]string `json:"arguments,omitempty"`
}
PromptsGetRequest is the request for prompts/get
type PromptsGetResponse ¶ added in v0.12.0
type PromptsGetResponse struct {
Description string `json:"description,omitempty"`
Messages []PromptMessage `json:"messages"`
}
PromptsGetResponse is the response for prompts/get
type PromptsListResponse ¶ added in v0.12.0
type PromptsListResponse struct {
Prompts []Prompt `json:"prompts"`
}
PromptsListResponse is the response for prompts/list
type Property ¶
type Property struct {
Type string `json:"type"`
Description string `json:"description,omitempty"`
Items *Items `json:"items,omitempty"` // For array types
Default any `json:"default,omitempty"`
Minimum *int `json:"minimum,omitempty"`
Maximum *int `json:"maximum,omitempty"`
Enum []string `json:"enum,omitempty"`
}
Property defines a single parameter in the input schema
type Resource ¶
type Resource struct {
URI string `json:"uri"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
MimeType string `json:"mimeType,omitempty"`
}
Resource definition
type ResourceContent ¶
type ResourceContent struct {
URI string `json:"uri"`
MimeType string `json:"mimeType,omitempty"`
Text string `json:"text,omitempty"`
Blob string `json:"blob,omitempty"` // Base64-encoded binary data
}
ResourceContent represents the content of a resource
type ResourceListChangedNotification ¶ added in v0.12.0
type ResourceListChangedNotification struct {
}
ResourceListChangedNotification is sent when the list of available resources changes This is a server-initiated notification sent to subscribed clients
type ResourcesCapability ¶
type ResourcesListResponse ¶
type ResourcesListResponse struct {
Resources []Resource `json:"resources"`
}
ResourcesListResponse is the response for resources/list
type ResourcesReadRequest ¶
type ResourcesReadRequest struct {
URI string `json:"uri"`
}
ResourcesReadRequest is the request for resources/read
type ResourcesReadResponse ¶
type ResourcesReadResponse struct {
Contents []ResourceContent `json:"contents"`
}
ResourcesReadResponse is the response for resources/read
type ResourcesSubscribeRequest ¶ added in v0.12.0
type ResourcesSubscribeRequest struct {
URI string `json:"uri"`
}
ResourcesSubscribeRequest is the request for resources/subscribe
type ResourcesSubscribeResponse ¶ added in v0.12.0
type ResourcesSubscribeResponse struct{}
ResourcesSubscribeResponse is the response for resources/subscribe (empty on success)
type ResourcesUnsubscribeRequest ¶ added in v0.12.0
type ResourcesUnsubscribeRequest struct {
URI string `json:"uri"`
}
ResourcesUnsubscribeRequest is the request for resources/unsubscribe
type ResourcesUnsubscribeResponse ¶ added in v0.12.0
type ResourcesUnsubscribeResponse struct{}
ResourcesUnsubscribeResponse is the response for resources/unsubscribe (empty on success)
type RootsCapability ¶
type RootsCapability struct{} // Placeholder, not used in Phase 1
type SamplingCapability ¶
type SamplingCapability struct{} // Placeholder, not used in Phase 1
type ServerCapabilities ¶
type ServerCapabilities struct {
Resources *ResourcesCapability `json:"resources,omitempty"`
Tools *ToolsCapability `json:"tools,omitempty"`
Prompts *PromptsCapability `json:"prompts,omitempty"`
}
type ServerInfo ¶
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema InputSchema `json:"inputSchema"`
}
Tool represents an MCP tool definition
type ToolContent ¶
type ToolContent struct {
Type string `json:"type"` // "text", "image", "resource"
Text string `json:"text,omitempty"`
}
ToolContent represents content returned by a tool
type ToolListChangedNotification ¶ added in v0.12.0
type ToolListChangedNotification struct {
}
ToolListChangedNotification is sent when the list of available tools changes This is a server-initiated notification sent to clients
type ToolsCallRequest ¶
type ToolsCallRequest struct {
Name string `json:"name"`
Arguments json.RawMessage `json:"arguments,omitempty"`
}
ToolsCallRequest is the request for tools/call
type ToolsCallResponse ¶
type ToolsCallResponse struct {
Content []ToolContent `json:"content"`
IsError bool `json:"isError,omitempty"`
}
ToolsCallResponse is the response for tools/call
type ToolsCapability ¶
type ToolsCapability struct {
ListChanged bool `json:"listChanged,omitempty"` // Phase 5
}
type ToolsListResponse ¶
type ToolsListResponse struct {
Tools []Tool `json:"tools"`
}
ToolsListResponse is the response for tools/list