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 PromptsCapability
- type Property
- type Resource
- type ResourceContent
- type ResourcesCapability
- type ResourcesListResponse
- type ResourcesReadRequest
- type ResourcesReadResponse
- type RootsCapability
- type SamplingCapability
- type ServerCapabilities
- type ServerInfo
- type Tool
- type ToolContent
- 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 PromptsCapability ¶
type PromptsCapability struct {
ListChanged bool `json:"listChanged,omitempty"` // Phase 5
}
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 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 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 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