Documentation
¶
Overview ¶
Package types provides shared types and interfaces for MCP components This avoids circular dependencies between packages
Index ¶
Constants ¶
View Source
const ( InvalidParams = -32602 FileSystemError = -32001 LanguageNotFound = -32002 SyntaxError = -32003 TransformFailed = -32004 )
Error codes for MCP
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MCPError ¶
type MCPError struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
MCPError represents an MCP protocol error
func NewMCPError ¶
NewMCPError creates a new MCP error
type Prompt ¶
type Prompt interface {
Component
Content() string
Arguments() []PromptArgument
}
Prompt represents a system prompt
type PromptArgument ¶
type PromptArgument struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
}
PromptArgument represents an argument for a prompt
type PromptDefinition ¶
type PromptDefinition struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Arguments []PromptArgument `json:"arguments,omitempty"`
}
PromptDefinition describes a prompt for the MCP client
type ResourceDefinition ¶
type ResourceDefinition struct {
URI string `json:"uri"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
MimeType string `json:"mimeType,omitempty"`
}
ResourceDefinition describes a resource for the MCP client
type ServerInterface ¶
type ServerInterface interface {
GetProviders() *providers.Registry
GetFileProcessor() *core.FileProcessor
GetStaging() any
GetSafety() any
}
ServerInterface defines what tools need from the server
type Tool ¶
type Tool interface {
Component
Handler() ToolHandler
InputSchema() map[string]any
}
Tool represents an executable tool with handler
type ToolDefinition ¶
type ToolDefinition struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"inputSchema"`
}
ToolDefinition describes a tool for the MCP client
type ToolHandler ¶
type ToolHandler func(params json.RawMessage) (any, error)
ToolHandler represents a function that handles a tool call
Click to show internal directories.
Click to hide internal directories.