Documentation
¶
Overview ¶
Package mcpserver provides MCP (Model Context Protocol) server functionality for CLASP. This allows CLASP to be used as an MCP server for tool integration with LLM applications.
Package mcpserver provides MCP tool definitions and execution for CLASP.
Index ¶
- Constants
- type CallToolParams
- type CallToolResult
- type ClientCapabilities
- type Content
- type Implementation
- type InitializeParams
- type InitializeResult
- type JSONRPCError
- type JSONRPCRequest
- type JSONRPCResponse
- type ListToolsResult
- type PromptCapability
- type ResourceCapability
- type RootsCapability
- type SamplingCapability
- type Server
- type ServerCapabilities
- type Session
- type Tool
- type ToolCapability
Constants ¶
const ( ParseError = -32700 InvalidRequest = -32600 MethodNotFound = -32601 InvalidParams = -32602 InternalError = -32603 )
MCP error codes
const Version = "0.48.9"
Version is the MCP server version
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallToolParams ¶
type CallToolParams struct {
Name string `json:"name"`
Arguments json.RawMessage `json:"arguments,omitempty"`
}
CallToolParams represents parameters for tools/call
type CallToolResult ¶
type CallToolResult struct {
Content []Content `json:"content"`
IsError bool `json:"isError,omitempty"`
}
CallToolResult represents the result of a tool call
type ClientCapabilities ¶
type ClientCapabilities struct {
Roots *RootsCapability `json:"roots,omitempty"`
Sampling *SamplingCapability `json:"sampling,omitempty"`
}
ClientCapabilities represents client capabilities
type Implementation ¶
Implementation represents server implementation details
type InitializeParams ¶
type InitializeParams struct {
ProtocolVersion string `json:"protocolVersion"`
ClientInfo Implementation `json:"clientInfo"`
Capabilities ClientCapabilities `json:"capabilities"`
}
InitializeParams represents initialization parameters from client
type InitializeResult ¶
type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"`
ServerInfo Implementation `json:"serverInfo"`
Capabilities ServerCapabilities `json:"capabilities"`
Instructions string `json:"instructions,omitempty"`
}
InitializeResult represents the initialization response
type JSONRPCError ¶
type JSONRPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
JSONRPCError represents a JSON-RPC 2.0 error
type JSONRPCRequest ¶
type JSONRPCRequest struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
JSONRPCRequest represents a JSON-RPC 2.0 request
type JSONRPCResponse ¶
type JSONRPCResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Result interface{} `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
JSONRPCResponse represents a JSON-RPC 2.0 response
type ListToolsResult ¶
type ListToolsResult struct {
Tools []Tool `json:"tools"`
}
ListToolsResult represents the response to tools/list
type PromptCapability ¶
type PromptCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
PromptCapability represents prompt-related capabilities
type ResourceCapability ¶
type ResourceCapability struct {
Subscribe bool `json:"subscribe,omitempty"`
ListChanged bool `json:"listChanged,omitempty"`
}
ResourceCapability represents resource-related capabilities
type RootsCapability ¶
type RootsCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
RootsCapability represents roots-related capabilities
type SamplingCapability ¶
type SamplingCapability struct{}
SamplingCapability represents sampling-related capabilities
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the MCP server
type ServerCapabilities ¶
type ServerCapabilities struct {
Tools *ToolCapability `json:"tools,omitempty"`
Resources *ResourceCapability `json:"resources,omitempty"`
Prompts *PromptCapability `json:"prompts,omitempty"`
}
ServerCapabilities represents the capabilities this server provides
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema interface{} `json:"inputSchema"`
}
Tool represents an MCP tool definition
type ToolCapability ¶
type ToolCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
ToolCapability represents tool-related capabilities