Documentation
¶
Index ¶
- func MarshalAny(v any) ([]byte, error)
- func UnmarshalAny(data []byte, dest any) error
- type Client
- type ClientStatus
- type Completion
- type CompletionArgument
- type CompletionReference
- type CompletionResult
- type Prompt
- type PromptListResult
- type PromptResult
- type Resource
- type ResourceContent
- type ResourceListResult
- type ResourceReadResult
- type ResourceTemplate
- type ResourceTemplateListResult
- type Tool
- type ToolListResult
- type ToolResult
- type TransportType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalAny ¶ added in v0.1.0
func UnmarshalAny ¶ added in v0.1.0
Types ¶
type Client ¶
type Client interface {
ID() string
Name() string
Status() ClientStatus
Connect(ctx context.Context) error
Disconnect(ctx context.Context) error
ListTools(ctx context.Context) ([]Tool, error)
CallTool(ctx context.Context, name string, args map[string]any) (*ToolResult, error)
ListResources(ctx context.Context) ([]Resource, error)
ReadResource(ctx context.Context, uri string) (*ResourceReadResult, error)
ListPrompts(ctx context.Context) ([]Prompt, error)
GetPrompt(ctx context.Context, name string, args map[string]any) (*PromptResult, error)
ListResourceTemplates(ctx context.Context) ([]ResourceTemplate, error)
Complete(ctx context.Context, ref CompletionReference, argument CompletionArgument, args map[string]string) (*CompletionResult, error)
}
Client represents a connection to an MCP server.
type ClientStatus ¶
type ClientStatus string
ClientStatus represents the connection status of an MCP client.
const ( ClientStatusInactive ClientStatus = "inactive" ClientStatusConnecting ClientStatus = "connecting" ClientStatusConnected ClientStatus = "connected" ClientStatusError ClientStatus = "error" )
type Completion ¶ added in v0.1.0
type CompletionArgument ¶ added in v0.1.0
type CompletionReference ¶ added in v0.1.0
type CompletionResult ¶ added in v0.1.0
type CompletionResult struct {
Completion Completion `json:"completion"`
Meta map[string]any `json:"_meta,omitempty"`
}
type PromptListResult ¶ added in v0.1.0
type PromptResult ¶
type PromptResult struct {
Description string `json:"description,omitempty"`
Messages []any `json:"messages"`
}
PromptResult is the result of getting a prompt.
type Resource ¶
type Resource struct {
URI string `json:"uri"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
MimeType string `json:"mimeType,omitempty"`
}
Resource represents a resource exposed by an MCP server.
type ResourceContent ¶
type ResourceContent struct {
URI string `json:"uri"`
MimeType string `json:"mimeType"`
Text string `json:"text,omitempty"`
Blob []byte `json:"blob,omitempty"`
}
ResourceContent is the content of a resource.
type ResourceListResult ¶ added in v0.1.0
type ResourceReadResult ¶ added in v0.1.0
type ResourceReadResult struct {
Contents []ResourceContent `json:"contents"`
}
type ResourceTemplate ¶ added in v0.1.0
type ResourceTemplateListResult ¶ added in v0.1.0
type ResourceTemplateListResult struct {
ResourceTemplates []ResourceTemplate `json:"resourceTemplates"`
NextCursor string `json:"nextCursor,omitempty"`
}
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"inputSchema,omitempty"`
}
Tool represents a tool exposed by an MCP server.
type ToolListResult ¶ added in v0.1.0
type ToolResult ¶
type ToolResult struct {
Content any `json:"content,omitempty"`
StructuredContent any `json:"structuredContent,omitempty"`
IsError bool `json:"isError"`
Meta map[string]any `json:"_meta,omitempty"`
}
ToolResult is the result of calling an MCP tool.
type TransportType ¶
type TransportType string
TransportType defines the MCP transport type.
const ( TransportStdio TransportType = "stdio" TransportSSE TransportType = "sse" TransportStreamableHTTP TransportType = "streamable_http" )
Click to show internal directories.
Click to hide internal directories.