mcp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalAny added in v0.1.0

func MarshalAny(v any) ([]byte, error)

func UnmarshalAny added in v0.1.0

func UnmarshalAny(data []byte, dest any) error

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 Completion struct {
	Values  []string `json:"values"`
	Total   *int     `json:"total,omitempty"`
	HasMore bool     `json:"hasMore,omitempty"`
}

type CompletionArgument added in v0.1.0

type CompletionArgument struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type CompletionReference added in v0.1.0

type CompletionReference struct {
	Type string `json:"type"`
	Name string `json:"name,omitempty"`
	URI  string `json:"uri,omitempty"`
}

type CompletionResult added in v0.1.0

type CompletionResult struct {
	Completion Completion     `json:"completion"`
	Meta       map[string]any `json:"_meta,omitempty"`
}

type Prompt

type Prompt struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

Prompt represents a prompt template exposed by an MCP server.

type PromptListResult added in v0.1.0

type PromptListResult struct {
	Prompts    []Prompt `json:"prompts"`
	NextCursor string   `json:"nextCursor,omitempty"`
}

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:"mime_type,omitempty"`
}

Resource represents a resource exposed by an MCP server.

type ResourceContent

type ResourceContent struct {
	URI      string `json:"uri"`
	MimeType string `json:"mime_type"`
	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 ResourceListResult struct {
	Resources  []Resource `json:"resources"`
	NextCursor string     `json:"nextCursor,omitempty"`
}

type ResourceReadResult added in v0.1.0

type ResourceReadResult struct {
	Contents []ResourceContent `json:"contents"`
}

type ResourceTemplate added in v0.1.0

type ResourceTemplate struct {
	Name        string `json:"name"`
	Title       string `json:"title,omitempty"`
	URITemplate string `json:"uriTemplate"`
	Description string `json:"description,omitempty"`
	MimeType    string `json:"mimeType,omitempty"`
}

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:"input_schema"`
}

Tool represents a tool exposed by an MCP server.

type ToolListResult added in v0.1.0

type ToolListResult struct {
	Tools      []Tool `json:"tools"`
	NextCursor string `json:"nextCursor,omitempty"`
}

type ToolResult

type ToolResult struct {
	Content           any            `json:"content,omitempty"`
	StructuredContent any            `json:"structured_content,omitempty"`
	IsError           bool           `json:"is_error"`
	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"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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