Documentation
¶
Index ¶
- type ClientInfoObj
- type ContentItem
- type InitializeParams
- type InitializeResult
- type JSONRPC
- func NewEmptyResponse(id interface{}) *JSONRPC
- func NewErrorResponse(id interface{}, code int, message string, data interface{}) *JSONRPC
- func NewInitializeRequest(id interface{}, clientName, clientVersion string, supportedVersions []string) *JSONRPC
- func NewNotificationRequest(method string, params interface{}) *JSONRPC
- func NewPromptRequest(id interface{}, name string, variables map[string]interface{}) *JSONRPC
- func NewPromptResponse(id interface{}, prompt, rendered string, metadata map[string]interface{}) *JSONRPC
- func NewResourceRequest(id interface{}, path string) *JSONRPC
- func NewResourceRequestWithOptions(id interface{}, path string, options map[string]interface{}) *JSONRPC
- func NewRootsListChangedNotification() *JSONRPC
- func NewRootsListResponse(id interface{}, roots []RootItem) *JSONRPC
- func NewSamplingAudioResponse(id interface{}, data string, mimeType string, model string, stopReason string) *JSONRPC
- func NewSamplingCreateMessageRequest(id interface{}, params SamplingCreateMessageParams) *JSONRPC
- func NewSamplingImageResponse(id interface{}, data string, mimeType string, model string, stopReason string) *JSONRPC
- func NewSamplingResponse(id interface{}, role string, content SamplingMessageContent, model string, ...) *JSONRPC
- func NewSamplingStreamingChunkResponse(id interface{}, chunkID string, role string, content SamplingMessageContent) *JSONRPC
- func NewSamplingStreamingCompletionResponse(id interface{}, model string, stopReason string) *JSONRPC
- func NewSamplingStreamingResponse(id interface{}, chunk *SamplingStreamingChunk, ...) *JSONRPC
- func NewSamplingStreamingTextChunk(id interface{}, chunkID string, text string) *JSONRPC
- func NewSamplingTextResponse(id interface{}, text string, model string, stopReason string) *JSONRPC
- func NewToolRequest(id interface{}, name string, args map[string]interface{}) *JSONRPC
- func NewToolResponse(id interface{}, output interface{}, metadata map[string]interface{}) *JSONRPC
- type PromptParams
- type PromptResult
- type RPCError
- type ResourceItem
- type ResourceParams
- type ResourceResult20241105
- type ResourceResult20250326
- type RootAddParams
- type RootItem
- type RootRemoveParams
- type RootsListResult
- type SamplingCreateMessageParams
- type SamplingMessage
- type SamplingMessageContent
- type SamplingModelHint
- type SamplingModelPreferences
- type SamplingResponse
- type SamplingStreamingChunk
- type SamplingStreamingCompletion
- type SamplingStreamingResponse
- type ServerInfoObj
- type ToolParams
- type ToolResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInfoObj ¶
ClientInfoObj defines the client information
type ContentItem ¶
type ContentItem struct {
Type string `json:"type"`
Text interface{} `json:"text,omitempty"`
URL string `json:"url,omitempty"`
AltText string `json:"altText,omitempty"`
Code string `json:"code,omitempty"`
Language string `json:"language,omitempty"`
Headers []string `json:"headers,omitempty"`
Rows [][]string `json:"rows,omitempty"`
}
ContentItem defines a content item in a resource
type InitializeParams ¶
type InitializeParams struct {
ClientInfo ClientInfoObj `json:"clientInfo"`
Versions []string `json:"versions"`
}
InitializeParams defines the parameters for an initialize request
type InitializeResult ¶
type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"`
ServerInfo ServerInfoObj `json:"serverInfo"`
Capabilities map[string]interface{} `json:"capabilities"`
}
InitializeResult defines the result of an initialize request
type JSONRPC ¶
type JSONRPC struct {
Version string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params interface{} `json:"params,omitempty"`
Result interface{} `json:"result,omitempty"`
Error *RPCError `json:"error,omitempty"`
}
JSONRPC defines the basic structure of a JSON-RPC message
func NewEmptyResponse ¶
func NewEmptyResponse(id interface{}) *JSONRPC
NewEmptyResponse creates an empty success response
func NewErrorResponse ¶
NewErrorResponse creates an error response
func NewInitializeRequest ¶
func NewInitializeRequest(id interface{}, clientName, clientVersion string, supportedVersions []string) *JSONRPC
NewInitializeRequest creates an initialize request
func NewNotificationRequest ¶
NewNotificationRequest creates a notification (no ID) with the given method and params
func NewPromptRequest ¶
NewPromptRequest creates a prompt request with the given name and variables
func NewPromptResponse ¶
func NewPromptResponse(id interface{}, prompt, rendered string, metadata map[string]interface{}) *JSONRPC
NewPromptResponse creates a response for a prompt
func NewResourceRequest ¶
NewResourceRequest creates a resource request for the given path
func NewResourceRequestWithOptions ¶
func NewResourceRequestWithOptions(id interface{}, path string, options map[string]interface{}) *JSONRPC
NewResourceRequestWithOptions creates a resource request with additional options
func NewRootsListChangedNotification ¶ added in v1.6.0
func NewRootsListChangedNotification() *JSONRPC
NewRootsListChangedNotification creates a notification when roots change
func NewRootsListResponse ¶
NewRootsListResponse creates a response for a roots/list request
func NewSamplingAudioResponse ¶
func NewSamplingAudioResponse(id interface{}, data string, mimeType string, model string, stopReason string) *JSONRPC
NewSamplingAudioResponse creates an audio response for a sampling/createMessage request
func NewSamplingCreateMessageRequest ¶
func NewSamplingCreateMessageRequest(id interface{}, params SamplingCreateMessageParams) *JSONRPC
NewSamplingCreateMessageRequest creates a sampling/createMessage request
func NewSamplingImageResponse ¶
func NewSamplingImageResponse(id interface{}, data string, mimeType string, model string, stopReason string) *JSONRPC
NewSamplingImageResponse creates an image response for a sampling/createMessage request
func NewSamplingResponse ¶
func NewSamplingResponse(id interface{}, role string, content SamplingMessageContent, model string, stopReason string) *JSONRPC
NewSamplingResponse creates a response for a sampling/createMessage request
func NewSamplingStreamingChunkResponse ¶
func NewSamplingStreamingChunkResponse(id interface{}, chunkID string, role string, content SamplingMessageContent) *JSONRPC
NewSamplingStreamingChunkResponse creates a streaming chunk response
func NewSamplingStreamingCompletionResponse ¶
func NewSamplingStreamingCompletionResponse(id interface{}, model string, stopReason string) *JSONRPC
NewSamplingStreamingCompletionResponse creates a streaming completion response
func NewSamplingStreamingResponse ¶
func NewSamplingStreamingResponse(id interface{}, chunk *SamplingStreamingChunk, completion *SamplingStreamingCompletion) *JSONRPC
NewSamplingStreamingResponse creates a streaming response for a sampling/createStreamingMessage request
func NewSamplingStreamingTextChunk ¶
NewSamplingStreamingTextChunk creates a streaming text chunk response
func NewSamplingTextResponse ¶
NewSamplingTextResponse creates a text response for a sampling/createMessage request
func NewToolRequest ¶
NewToolRequest creates a tool request with the given name and arguments
func NewToolResponse ¶
NewToolResponse creates a response for a tool execution
type PromptParams ¶
type PromptParams struct {
Name string `json:"name"`
Arguments map[string]interface{} `json:"arguments"`
}
PromptParams defines parameters for prompt retrieval
type PromptResult ¶
type PromptResult struct {
Prompt string `json:"prompt"`
Rendered string `json:"rendered"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
PromptResult defines the result of a prompt retrieval
type RPCError ¶
type RPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
RPCError defines the structure of a JSON-RPC error
type ResourceItem ¶
type ResourceItem struct {
URI string `json:"uri"`
Text string `json:"text"`
Content []ContentItem `json:"content"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
ResourceItem defines a single resource in a resource response
type ResourceParams ¶
type ResourceParams struct {
URI string `json:"uri"`
Options map[string]interface{} `json:"options,omitempty"`
}
ResourceParams defines parameters for resource retrieval
type ResourceResult20241105 ¶
type ResourceResult20241105 struct {
Content []ContentItem `json:"content"`
}
ResourceResult20241105 defines the result of a resource retrieval for v20241105
type ResourceResult20250326 ¶
type ResourceResult20250326 struct {
Contents []ResourceItem `json:"contents"`
}
ResourceResult20250326 defines the result of a resource retrieval for v20250326
type RootAddParams ¶
RootAddParams defines parameters for adding a root
type RootItem ¶
type RootItem struct {
URI string `json:"uri"`
Name string `json:"name"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
RootItem defines a root resource
type RootRemoveParams ¶
type RootRemoveParams struct {
URI string `json:"uri"`
}
RootRemoveParams defines parameters for removing a root
type RootsListResult ¶
type RootsListResult struct {
Roots []RootItem `json:"roots"`
}
RootsListResult defines the result of a roots/list request
type SamplingCreateMessageParams ¶
type SamplingCreateMessageParams struct {
Messages []SamplingMessage `json:"messages"`
ModelPreferences SamplingModelPreferences `json:"modelPreferences"`
SystemPrompt string `json:"systemPrompt,omitempty"`
MaxTokens int `json:"maxTokens,omitempty"`
}
SamplingCreateMessageParams represents the parameters for a sampling/createMessage request
func NewSamplingCreateMessageParams ¶
func NewSamplingCreateMessageParams(messages []SamplingMessage, modelPreferences SamplingModelPreferences) SamplingCreateMessageParams
NewSamplingCreateMessageParams creates parameters for a sampling/createMessage request
type SamplingMessage ¶
type SamplingMessage struct {
Role string `json:"role"`
Content SamplingMessageContent `json:"content"`
}
SamplingMessage represents a message in a sampling conversation
type SamplingMessageContent ¶
type SamplingMessageContent struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Data string `json:"data,omitempty"`
MimeType string `json:"mimeType,omitempty"`
}
SamplingMessageContent represents the content of a sampling message
type SamplingModelHint ¶
type SamplingModelHint struct {
Name string `json:"name"`
}
SamplingModelHint represents a hint for model selection
type SamplingModelPreferences ¶
type SamplingModelPreferences struct {
Hints []SamplingModelHint `json:"hints,omitempty"`
CostPriority *float64 `json:"costPriority,omitempty"`
SpeedPriority *float64 `json:"speedPriority,omitempty"`
IntelligencePriority *float64 `json:"intelligencePriority,omitempty"`
}
SamplingModelPreferences represents model preferences for a sampling request
type SamplingResponse ¶
type SamplingResponse struct {
Role string `json:"role"`
Content SamplingMessageContent `json:"content"`
Model string `json:"model,omitempty"`
StopReason string `json:"stopReason,omitempty"`
}
SamplingResponse represents the response to a sampling/createMessage request
type SamplingStreamingChunk ¶
type SamplingStreamingChunk struct {
ChunkID string `json:"chunkId"`
Role string `json:"role,omitempty"`
Content SamplingMessageContent `json:"content"`
}
SamplingStreamingChunk represents a chunk of a streaming response
type SamplingStreamingCompletion ¶
type SamplingStreamingCompletion struct {
Model string `json:"model,omitempty"`
StopReason string `json:"stopReason,omitempty"`
}
SamplingStreamingCompletion represents the completion of a streaming response
type SamplingStreamingResponse ¶
type SamplingStreamingResponse struct {
Chunk *SamplingStreamingChunk `json:"chunk,omitempty"`
Completion *SamplingStreamingCompletion `json:"completion,omitempty"`
}
SamplingStreamingResponse represents a streaming response to a sampling request
type ServerInfoObj ¶
ServerInfoObj defines the server information
type ToolParams ¶
type ToolParams struct {
Name string `json:"name"`
Arguments map[string]interface{} `json:"arguments"`
}
ToolParams defines parameters for tool execution
type ToolResult ¶
type ToolResult struct {
Output interface{} `json:"output"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
ToolResult defines the result of a tool execution