Documentation
¶
Index ¶
- Constants
- type CallToolParams
- type CallToolResult
- type ClientCapabilities
- type ClientInfo
- type Content
- type Error
- type InitializeParams
- type InitializeResult
- type InputSchema
- type ListToolsParams
- type ListToolsResult
- type Message
- type Notification
- type PromptCapabilities
- type PromptsCapability
- type Property
- func NewArrayProperty(description string, items Property) Property
- func NewBooleanProperty(description string) Property
- func NewEnumProperty(description string, values ...string) Property
- func NewIntegerProperty(description string) Property
- func NewProperty(propType, description string) Property
- func NewStringProperty(description string) Property
- type Request
- type ResourceCapabilities
- type ResourcesCapability
- type Response
- type Server
- type ServerCapabilities
- type ServerConfig
- type ServerInfo
- type StdioTransport
- type Tool
- type ToolCapabilities
- type ToolDefinition
- type ToolHandler
- type ToolRegistry
- func (r *ToolRegistry) CallTool(ctx context.Context, name string, arguments map[string]interface{}) (*CallToolResult, error)
- func (r *ToolRegistry) GetTool(name string) (*ToolDefinition, bool)
- func (r *ToolRegistry) ListTools() []Tool
- func (r *ToolRegistry) ListToolsFiltered(enabledTools []string, readOnlyMode bool) []Tool
- func (r *ToolRegistry) RegisterTool(def *ToolDefinition) error
- type ToolsCapability
Constants ¶
const ( ParseError = -32700 InvalidRequest = -32600 MethodNotFound = -32601 InvalidParams = -32602 InternalError = -32603 )
Error codes
const ( ProtocolVersion = "2024-11-05" ServerName = "go-mcp-atlassian" ServerVersion = "0.1.0" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallToolParams ¶
type CallToolParams struct {
Name string `json:"name"`
Arguments map[string]interface{} `json:"arguments,omitempty"`
}
CallToolParams represents the parameters for the tools/call method
type CallToolResult ¶
type CallToolResult struct {
Content []Content `json:"content"`
IsError bool `json:"isError,omitempty"`
}
CallToolResult represents the result of the tools/call method
func NewErrorResult ¶
func NewErrorResult(err error) *CallToolResult
NewErrorResult creates an error tool result
func NewJSONResult ¶
func NewJSONResult(data interface{}) (*CallToolResult, error)
NewJSONResult creates a tool result with JSON-formatted text
func NewSuccessResult ¶
func NewSuccessResult(text string) *CallToolResult
NewSuccessResult creates a successful tool result with text content
type ClientCapabilities ¶
type ClientCapabilities struct {
Tools *ToolCapabilities `json:"tools,omitempty"`
Resources *ResourceCapabilities `json:"resources,omitempty"`
Prompts *PromptCapabilities `json:"prompts,omitempty"`
}
ClientCapabilities represents the capabilities of the client
type ClientInfo ¶
ClientInfo represents information about the client
type Content ¶
Content represents content in the result
func NewTextContent ¶
NewTextContent creates a new text content item
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
Error represents a JSON-RPC 2.0 error
type InitializeParams ¶
type InitializeParams struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities ClientCapabilities `json:"capabilities"`
ClientInfo ClientInfo `json:"clientInfo"`
Meta map[string]interface{} `json:"meta,omitempty"`
}
InitializeParams represents the parameters for the initialize method
type InitializeResult ¶
type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities ServerCapabilities `json:"capabilities"`
ServerInfo ServerInfo `json:"serverInfo"`
Instructions string `json:"instructions,omitempty"`
}
InitializeResult represents the result of the initialize method
type InputSchema ¶
type InputSchema struct {
Type string `json:"type"`
Properties map[string]Property `json:"properties"`
Required []string `json:"required,omitempty"`
Additional map[string]interface{} `json:"-"` // For additional schema properties
}
InputSchema represents the JSON schema for tool input
func NewInputSchema ¶
func NewInputSchema(properties map[string]Property, required ...string) InputSchema
NewInputSchema creates a new input schema
type ListToolsParams ¶
type ListToolsParams struct {
Cursor string `json:"cursor,omitempty"`
}
ListToolsParams represents the parameters for the tools/list method
type ListToolsResult ¶
type ListToolsResult struct {
Tools []Tool `json:"tools"`
NextCursor string `json:"nextCursor,omitempty"`
}
ListToolsResult represents the result of the tools/list method
type Message ¶
type Message struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Result interface{} `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
Message represents any JSON-RPC message (request, response, or notification)
func (*Message) IsNotification ¶
IsNotification returns true if the message is a notification
func (*Message) IsResponse ¶
IsResponse returns true if the message is a response
func (*Message) ToNotification ¶
func (m *Message) ToNotification() *Notification
ToNotification converts the message to a Notification
func (*Message) ToResponse ¶
ToResponse converts the message to a Response
type Notification ¶
type Notification struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
Notification represents a JSON-RPC 2.0 notification
func NewNotification ¶
func NewNotification(method string, params interface{}) (*Notification, error)
NewNotification creates a new notification
type PromptCapabilities ¶
type PromptCapabilities struct {
ListChanged bool `json:"listChanged,omitempty"`
}
PromptCapabilities represents prompt-related capabilities
type PromptsCapability ¶
type PromptsCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
PromptsCapability represents prompt capabilities
type Property ¶
type Property struct {
Type string `json:"type"`
Description string `json:"description,omitempty"`
Default interface{} `json:"default,omitempty"`
Enum []string `json:"enum,omitempty"`
Items *Property `json:"items,omitempty"`
}
Property represents a property in the input schema
func NewArrayProperty ¶
NewArrayProperty creates a new array property
func NewBooleanProperty ¶
NewBooleanProperty creates a new boolean property
func NewEnumProperty ¶
NewEnumProperty creates a new enum property
func NewIntegerProperty ¶
NewIntegerProperty creates a new integer property
func NewProperty ¶
NewProperty creates a new property definition
func NewStringProperty ¶
NewStringProperty creates a new string property
func (Property) WithDefault ¶
WithDefault adds a default value to a property
type Request ¶
type Request struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
Request represents a JSON-RPC 2.0 request
type ResourceCapabilities ¶
type ResourceCapabilities struct {
Subscribe bool `json:"subscribe,omitempty"`
ListChanged bool `json:"listChanged,omitempty"`
}
ResourceCapabilities represents resource-related capabilities
type ResourcesCapability ¶
type ResourcesCapability struct {
Subscribe bool `json:"subscribe,omitempty"`
ListChanged bool `json:"listChanged,omitempty"`
}
ResourcesCapability represents resource capabilities
type Response ¶
type Response struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Result interface{} `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
Response represents a JSON-RPC 2.0 response
func NewErrorResponse ¶
NewErrorResponse creates a new error response
func NewResponse ¶
func NewResponse(id interface{}, result interface{}) *Response
NewResponse creates a new successful response
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the MCP server
func (*Server) HandleMessage ¶
HandleMessage handles an incoming JSON-RPC message
func (*Server) RegisterTool ¶
func (s *Server) RegisterTool(def *ToolDefinition) error
RegisterTool registers a new tool
type ServerCapabilities ¶
type ServerCapabilities struct {
Tools *ToolsCapability `json:"tools,omitempty"`
Resources *ResourcesCapability `json:"resources,omitempty"`
Prompts *PromptsCapability `json:"prompts,omitempty"`
}
ServerCapabilities represents the capabilities of the server
type ServerConfig ¶
ServerConfig holds the configuration for the MCP server
type ServerInfo ¶
ServerInfo represents information about the server
type StdioTransport ¶
type StdioTransport struct {
// contains filtered or unexported fields
}
StdioTransport implements the stdio transport for MCP
func NewStdioTransport ¶
func NewStdioTransport(server *Server, logger *zerolog.Logger) *StdioTransport
NewStdioTransport creates a new stdio transport
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema InputSchema `json:"inputSchema"`
}
Tool represents a tool definition
type ToolCapabilities ¶
type ToolCapabilities struct {
ListChanged bool `json:"listChanged,omitempty"`
}
ToolCapabilities represents tool-related capabilities
type ToolDefinition ¶
type ToolDefinition struct {
Tool
Handler ToolHandler
Tags []string // For filtering (e.g., "jira", "confluence", "read", "write")
}
ToolDefinition represents a complete tool definition
func NewTool ¶
func NewTool(name, description string, schema InputSchema, handler ToolHandler, tags ...string) *ToolDefinition
NewTool creates a new tool definition
type ToolHandler ¶
type ToolHandler func(ctx context.Context, arguments map[string]interface{}) (*CallToolResult, error)
ToolHandler is a function that handles a tool call
type ToolRegistry ¶
type ToolRegistry struct {
// contains filtered or unexported fields
}
ToolRegistry manages tool registration and execution
func NewToolRegistry ¶
func NewToolRegistry() *ToolRegistry
NewToolRegistry creates a new tool registry
func (*ToolRegistry) CallTool ¶
func (r *ToolRegistry) CallTool(ctx context.Context, name string, arguments map[string]interface{}) (*CallToolResult, error)
CallTool executes a tool by name with the given arguments
func (*ToolRegistry) GetTool ¶
func (r *ToolRegistry) GetTool(name string) (*ToolDefinition, bool)
GetTool returns a tool definition by name
func (*ToolRegistry) ListTools ¶
func (r *ToolRegistry) ListTools() []Tool
ListTools returns all registered tools
func (*ToolRegistry) ListToolsFiltered ¶
func (r *ToolRegistry) ListToolsFiltered(enabledTools []string, readOnlyMode bool) []Tool
ListToolsFiltered returns tools filtered by tags and enabled list
func (*ToolRegistry) RegisterTool ¶
func (r *ToolRegistry) RegisterTool(def *ToolDefinition) error
RegisterTool registers a new tool with its handler
type ToolsCapability ¶
type ToolsCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
ToolsCapability represents tool capabilities