protocol

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

pkg/protocol/protocol.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCapabilities

func ValidateCapabilities(serverCapabilities MCPCapabilities, requiredCapabilities []string) error

ValidateCapabilities checks if the server capabilities match the given capabilities

Types

type InitializeRequest

type InitializeRequest struct {
	ProtocolVersion string          `json:"protocolVersion"`
	Capabilities    MCPCapabilities `json:"capabilities"`
	ClientInfo      struct {
		Name    string `json:"name"`
		Version string `json:"version"`
	} `json:"clientInfo"`
}

InitializeRequest represents an initialize request

type InitializeResponse

type InitializeResponse struct {
	ProtocolVersion string          `json:"protocolVersion"`
	Capabilities    MCPCapabilities `json:"capabilities"`
	ServerInfo      struct {
		Name    string `json:"name"`
		Version string `json:"version"`
	} `json:"serverInfo"`
	Instructions string `json:"instructions,omitempty"`
}

InitializeResponse represents an initialize response

type LoggingCapability

type LoggingCapability struct {
}

LoggingCapability represents logging capability

type MCPCapabilities

type MCPCapabilities struct {
	Resources *ResourcesCapability `json:"resources,omitempty"`
	Tools     *ToolsCapability     `json:"tools,omitempty"`
	Prompts   *PromptsCapability   `json:"prompts,omitempty"`
	Sampling  *SamplingCapability  `json:"sampling,omitempty"`
	Logging   *LoggingCapability   `json:"logging,omitempty"`
}

MCPCapabilities represents MCP capabilities

type MCPError

type MCPError struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

MCPError represents an MCP error

type MCPNotification

type MCPNotification struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

MCPNotification represents an MCP notification

type MCPRequest

type MCPRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      interface{}     `json:"id"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

MCPRequest represents an MCP request

type MCPResponse

type MCPResponse struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      interface{}     `json:"id"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *MCPError       `json:"error,omitempty"`
}

MCPResponse represents an MCP response

type PromptsCapability

type PromptsCapability struct {
	ListChanged bool `json:"listChanged,omitempty"`
}

PromptsCapability represents prompts capability

type ResourcesCapability

type ResourcesCapability struct {
	ListChanged bool `json:"listChanged,omitempty"`
	Subscribe   bool `json:"subscribe,omitempty"`
}

ResourcesCapability represents resources capability

type SamplingCapability

type SamplingCapability struct {
}

SamplingCapability represents sampling capability

type ToolsCapability

type ToolsCapability struct {
	ListChanged bool `json:"listChanged,omitempty"`
}

ToolsCapability represents tools capability

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL