Documentation
¶
Index ¶
- type CompletionHandler
- type Elicitor
- type FastMCP
- func (f *FastMCP) Completion(handler CompletionHandler)
- func (f *FastMCP) GetCapabilities() protocol.ServerCapabilities
- func (f *FastMCP) GetServerInfo() protocol.ServerInfo
- func (f *FastMCP) HandleMessage(ctx context.Context, data []byte) ([]byte, error)
- func (f *FastMCP) Prompt(name, description string) *PromptBuilder
- func (f *FastMCP) RequestRootsList(ctx context.Context) (*protocol.ListRootsResult, error)
- func (f *FastMCP) Resource(uri, name, description string) *ResourceBuilder
- func (f *FastMCP) ResourceTemplate(uriTemplate, name, description string) *ResourceTemplateBuilder
- func (f *FastMCP) SendNotification(method string, params interface{}) error
- func (f *FastMCP) Server() *MCPServer
- func (f *FastMCP) SetElicitor(elicitor Elicitor)
- func (f *FastMCP) SetNotificationHandler(handler func(method string, params interface{}) error)
- func (f *FastMCP) SetRequestSender(...)
- func (f *FastMCP) SimpleElicitationTool(name, description string, ...) error
- func (f *FastMCP) SimpleStructuredTool(name, description string, outputSchema protocol.JSONSchema, ...) error
- func (f *FastMCP) SimpleStructuredToolWithText(name, description string, outputSchema protocol.JSONSchema, ...) error
- func (f *FastMCP) SimpleTextPrompt(name, description string, ...) error
- func (f *FastMCP) SimpleTextResource(uri, name, description string, ...) error
- func (f *FastMCP) SimpleTextTool(name, description string, ...) error
- func (f *FastMCP) Tool(name, description string) *ToolBuilder
- type MCPContext
- func (c *MCPContext) CreateConversationMessage(messages []protocol.SamplingMessage, maxTokens int) (*protocol.CreateMessageResult, error)
- func (c *MCPContext) CreateMessage(request *protocol.CreateMessageRequest) (*protocol.CreateMessageResult, error)
- func (c *MCPContext) CreateTextMessage(userMessage string, maxTokens int) (*protocol.CreateMessageResult, error)
- func (c *MCPContext) CreateTextMessageWithSystem(systemPrompt, userMessage string, maxTokens int) (*protocol.CreateMessageResult, error)
- func (c *MCPContext) Elicit(message string, schema protocol.JSONSchema) (*protocol.ElicitationResult, error)
- func (c *MCPContext) ElicitBoolean(message, name, description string, defaultValue *bool, required bool) (bool, error)
- func (c *MCPContext) ElicitChoice(message, name, description string, options, optionNames []string, ...) (string, error)
- func (c *MCPContext) ElicitMultiple(message string, schema protocol.JSONSchema) (map[string]interface{}, error)
- func (c *MCPContext) ElicitNumber(message, name, description string, min, max *float64, required bool) (float64, error)
- func (c *MCPContext) ElicitString(message, name, description string, required bool) (string, error)
- func (c *MCPContext) Server() *MCPServer
- type MCPServer
- func (s *MCPServer) CreateMCPContext(ctx context.Context) *MCPContext
- func (s *MCPServer) GetCapabilities() protocol.ServerCapabilities
- func (s *MCPServer) GetLoggingLevel() protocol.LoggingLevel
- func (s *MCPServer) GetServerInfo() protocol.ServerInfo
- func (s *MCPServer) HandleMessage(ctx context.Context, message *protocol.JSONRPCMessage) (*protocol.JSONRPCMessage, error)
- func (s *MCPServer) NotifyCancelled(requestID any, reason string) error
- func (s *MCPServer) NotifyProgress(progressToken any, progress, total float64, message string) error
- func (s *MCPServer) NotifyResourceUpdated(uri string) error
- func (s *MCPServer) RegisterCompletionHandler(handler CompletionHandler)
- func (s *MCPServer) RegisterPrompt(name, description string, arguments []protocol.PromptArgument, ...) error
- func (s *MCPServer) RegisterResource(uri, name, description, mimeType string, handler ResourceHandler, ...) error
- func (s *MCPServer) RegisterResourceTemplate(uriTemplate, name, description, mimeType string, meta ...map[string]any) error
- func (s *MCPServer) RegisterTool(name, description string, inputSchema protocol.JSONSchema, handler ToolHandler, ...) error
- func (s *MCPServer) RequestRootsList(ctx context.Context) (*protocol.ListRootsResult, error)
- func (s *MCPServer) SendLog(level protocol.LoggingLevel, data any, logger string) error
- func (s *MCPServer) SendNotification(method string, params interface{}) error
- func (s *MCPServer) SetElicitor(elicitor Elicitor)
- func (s *MCPServer) SetLoggingLevel(level protocol.LoggingLevel)
- func (s *MCPServer) SetNotificationHandler(handler func(method string, params interface{}) error)
- func (s *MCPServer) SetRequestSender(...)
- func (s *MCPServer) UnregisterCompletionHandler()
- func (s *MCPServer) UnregisterPrompt(name string) error
- func (s *MCPServer) UnregisterResource(uri string) error
- func (s *MCPServer) UnregisterResourceTemplate(uriTemplate string) error
- func (s *MCPServer) UnregisterTool(name string) error
- type MockElicitor
- type PromptBuilder
- type PromptHandler
- type PromptHandlerWithElicitation
- type PromptOptions
- type PromptRegistration
- type ResourceBuilder
- type ResourceHandler
- type ResourceHandlerWithElicitation
- type ResourceRegistration
- type ResourceTemplateBuilder
- type ResourceTemplateRegistration
- type Server
- type ToolBuilder
- func (tb *ToolBuilder) Handle(handler ToolHandler) error
- func (tb *ToolBuilder) HandleWithElicitation(handler ToolHandlerWithElicitation) error
- func (tb *ToolBuilder) HandleWithValidation(handler ToolHandler) error
- func (tb *ToolBuilder) WithBoolParam(name, description string, required bool) *ToolBuilder
- func (tb *ToolBuilder) WithInputSchema(schema protocol.JSONSchema) *ToolBuilder
- func (tb *ToolBuilder) WithIntParam(name, description string, required bool) *ToolBuilder
- func (tb *ToolBuilder) WithMeta(key string, value interface{}) *ToolBuilder
- func (tb *ToolBuilder) WithNumberParam(name, description string, required bool) *ToolBuilder
- func (tb *ToolBuilder) WithOutputSchema(schema protocol.JSONSchema) *ToolBuilder
- func (tb *ToolBuilder) WithStringParam(name, description string, required bool) *ToolBuilder
- func (tb *ToolBuilder) WithStructOutputSchema(v interface{}) *ToolBuilder
- func (tb *ToolBuilder) WithStructSchema(v interface{}) *ToolBuilder
- func (tb *ToolBuilder) WithTitle(title string) *ToolBuilder
- type ToolHandler
- type ToolHandlerWithElicitation
- type ToolOptions
- type ToolRegistration
- type TransportElicitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletionHandler ¶ added in v1.1.2
type CompletionHandler func(ctx context.Context, ref protocol.CompletionReference, argument protocol.CompletionArgument, context *protocol.CompletionContext) (*protocol.CompletionResult, error)
type Elicitor ¶ added in v1.1.1
type Elicitor interface {
// Elicit sends an elicitation request and waits for response
Elicit(ctx context.Context, method string, params interface{}) (*protocol.JSONRPCMessage, error)
// CreateMessage sends a sampling request and waits for response
CreateMessage(ctx context.Context, request *protocol.CreateMessageRequest) (*protocol.CreateMessageResult, error)
}
Elicitor interface for handling elicitation and sampling requests
type FastMCP ¶
type FastMCP struct {
// contains filtered or unexported fields
}
func NewFastMCP ¶
func (*FastMCP) Completion ¶ added in v1.1.2
func (f *FastMCP) Completion(handler CompletionHandler)
Completion registers a completion handler (MCP 2025-06-18)
func (*FastMCP) GetCapabilities ¶
func (f *FastMCP) GetCapabilities() protocol.ServerCapabilities
func (*FastMCP) GetServerInfo ¶
func (f *FastMCP) GetServerInfo() protocol.ServerInfo
func (*FastMCP) HandleMessage ¶
func (*FastMCP) Prompt ¶
func (f *FastMCP) Prompt(name, description string) *PromptBuilder
Prompt prompt template fluent API
func (*FastMCP) RequestRootsList ¶ added in v1.1.2
func (*FastMCP) Resource ¶
func (f *FastMCP) Resource(uri, name, description string) *ResourceBuilder
Resource resource fluent API
func (*FastMCP) ResourceTemplate ¶ added in v1.1.2
func (f *FastMCP) ResourceTemplate(uriTemplate, name, description string) *ResourceTemplateBuilder
func (*FastMCP) SendNotification ¶
func (*FastMCP) SetElicitor ¶ added in v1.1.1
func (*FastMCP) SetNotificationHandler ¶
func (*FastMCP) SetRequestSender ¶ added in v1.1.2
func (*FastMCP) SimpleElicitationTool ¶ added in v1.1.1
func (f *FastMCP) SimpleElicitationTool(name, description string, handler func(ctx *MCPContext, args map[string]interface{}) (string, error)) error
SimpleElicitationTool creates a simple tool with elicitation support
func (*FastMCP) SimpleStructuredTool ¶ added in v1.1.0
func (f *FastMCP) SimpleStructuredTool(name, description string, outputSchema protocol.JSONSchema, handler func(ctx context.Context, args map[string]interface{}) (interface{}, error)) error
SimpleStructuredTool creates a simple tool that returns structured data (MCP 2025-06-18)
func (*FastMCP) SimpleStructuredToolWithText ¶ added in v1.1.0
func (f *FastMCP) SimpleStructuredToolWithText(name, description string, outputSchema protocol.JSONSchema, handler func(ctx context.Context, args map[string]interface{}) (string, interface{}, error)) error
SimpleStructuredToolWithText creates a tool that returns both text and structured data
func (*FastMCP) SimpleTextPrompt ¶
func (*FastMCP) SimpleTextResource ¶
func (*FastMCP) SimpleTextTool ¶
func (*FastMCP) Tool ¶
func (f *FastMCP) Tool(name, description string) *ToolBuilder
type MCPContext ¶ added in v1.1.1
MCPContext provides MCP-specific context functionality, including elicitation support
func NewMCPContext ¶ added in v1.1.1
func NewMCPContext(ctx context.Context, server *MCPServer, elicitor Elicitor) *MCPContext
NewMCPContext creates a new MCP context
func (*MCPContext) CreateConversationMessage ¶ added in v1.1.1
func (c *MCPContext) CreateConversationMessage(messages []protocol.SamplingMessage, maxTokens int) (*protocol.CreateMessageResult, error)
CreateConversationMessage creates a sampling request with conversation history
func (*MCPContext) CreateMessage ¶ added in v1.1.1
func (c *MCPContext) CreateMessage(request *protocol.CreateMessageRequest) (*protocol.CreateMessageResult, error)
CreateMessage sends a sampling request to the client
func (*MCPContext) CreateTextMessage ¶ added in v1.1.1
func (c *MCPContext) CreateTextMessage(userMessage string, maxTokens int) (*protocol.CreateMessageResult, error)
CreateTextMessage creates a simple text-based sampling request
func (*MCPContext) CreateTextMessageWithSystem ¶ added in v1.1.1
func (c *MCPContext) CreateTextMessageWithSystem(systemPrompt, userMessage string, maxTokens int) (*protocol.CreateMessageResult, error)
CreateTextMessageWithSystem creates a text-based sampling request with system prompt
func (*MCPContext) Elicit ¶ added in v1.1.1
func (c *MCPContext) Elicit(message string, schema protocol.JSONSchema) (*protocol.ElicitationResult, error)
Elicit sends an elicitation request
func (*MCPContext) ElicitBoolean ¶ added in v1.1.1
func (c *MCPContext) ElicitBoolean(message, name, description string, defaultValue *bool, required bool) (bool, error)
ElicitBoolean requests user to input a boolean value
func (*MCPContext) ElicitChoice ¶ added in v1.1.1
func (c *MCPContext) ElicitChoice(message, name, description string, options, optionNames []string, required bool) (string, error)
ElicitChoice requests user to choose from options
func (*MCPContext) ElicitMultiple ¶ added in v1.1.1
func (c *MCPContext) ElicitMultiple(message string, schema protocol.JSONSchema) (map[string]interface{}, error)
ElicitMultiple requests user to input multiple fields
func (*MCPContext) ElicitNumber ¶ added in v1.1.1
func (c *MCPContext) ElicitNumber(message, name, description string, min, max *float64, required bool) (float64, error)
ElicitNumber requests user to input a number
func (*MCPContext) ElicitString ¶ added in v1.1.1
func (c *MCPContext) ElicitString(message, name, description string, required bool) (string, error)
ElicitString requests user to input a string
func (*MCPContext) Server ¶ added in v1.1.1
func (c *MCPContext) Server() *MCPServer
Server gets the associated MCP server
type MCPServer ¶
type MCPServer struct {
// contains filtered or unexported fields
}
func (*MCPServer) CreateMCPContext ¶ added in v1.1.1
func (s *MCPServer) CreateMCPContext(ctx context.Context) *MCPContext
CreateMCPContext creates MCP context with elicitation support
func (*MCPServer) GetCapabilities ¶
func (s *MCPServer) GetCapabilities() protocol.ServerCapabilities
GetCapabilities gets server capabilities
func (*MCPServer) GetLoggingLevel ¶ added in v1.1.6
func (s *MCPServer) GetLoggingLevel() protocol.LoggingLevel
GetLoggingLevel 获取当前日志级别
func (*MCPServer) GetServerInfo ¶
func (s *MCPServer) GetServerInfo() protocol.ServerInfo
GetServerInfo gets server information
func (*MCPServer) HandleMessage ¶
func (s *MCPServer) HandleMessage(ctx context.Context, message *protocol.JSONRPCMessage) (*protocol.JSONRPCMessage, error)
HandleMessage handles JSON-RPC messages
func (*MCPServer) NotifyCancelled ¶ added in v1.1.6
func (*MCPServer) NotifyProgress ¶ added in v1.1.6
func (*MCPServer) NotifyResourceUpdated ¶ added in v1.1.6
NotifyResourceUpdated 通知所有订阅者资源已更新
func (*MCPServer) RegisterCompletionHandler ¶ added in v1.1.2
func (s *MCPServer) RegisterCompletionHandler(handler CompletionHandler)
RegisterCompletionHandler registers completion handler (MCP 2025-06-18)
func (*MCPServer) RegisterPrompt ¶
func (s *MCPServer) RegisterPrompt(name, description string, arguments []protocol.PromptArgument, handler PromptHandler, opts ...PromptOptions) error
RegisterPrompt registers prompt template
func (*MCPServer) RegisterResource ¶
func (s *MCPServer) RegisterResource(uri, name, description, mimeType string, handler ResourceHandler, meta ...map[string]any) error
RegisterResource registers resource
func (*MCPServer) RegisterResourceTemplate ¶ added in v1.1.2
func (s *MCPServer) RegisterResourceTemplate(uriTemplate, name, description, mimeType string, meta ...map[string]any) error
RegisterResourceTemplate registers a resource template
func (*MCPServer) RegisterTool ¶
func (s *MCPServer) RegisterTool(name, description string, inputSchema protocol.JSONSchema, handler ToolHandler, opts ...ToolOptions) error
RegisterTool registers tool with optional output schema support
func (*MCPServer) RequestRootsList ¶ added in v1.1.2
RequestRootsList root list
func (*MCPServer) SendNotification ¶
SendNotification sends notification
func (*MCPServer) SetElicitor ¶ added in v1.1.1
SetElicitor sets elicitation handler
func (*MCPServer) SetLoggingLevel ¶ added in v1.1.6
func (s *MCPServer) SetLoggingLevel(level protocol.LoggingLevel)
SetLoggingLevel 设置日志级别
func (*MCPServer) SetNotificationHandler ¶
SetNotificationHandler sets notification handler
func (*MCPServer) SetRequestSender ¶ added in v1.1.2
func (s *MCPServer) SetRequestSender(sender func(ctx context.Context, method string, params interface{}) (*protocol.JSONRPCMessage, error))
SetRequestSender sets request sender for server-initiated requests
func (*MCPServer) UnregisterCompletionHandler ¶ added in v1.1.2
func (s *MCPServer) UnregisterCompletionHandler()
UnregisterCompletionHandler unregisters completion handler
func (*MCPServer) UnregisterPrompt ¶
UnregisterPrompt unregisters prompt template
func (*MCPServer) UnregisterResource ¶
UnregisterResource unregisters resource
func (*MCPServer) UnregisterResourceTemplate ¶ added in v1.1.2
UnregisterResourceTemplate unregisters a resource template
func (*MCPServer) UnregisterTool ¶
UnregisterTool unregisters tool
type MockElicitor ¶ added in v1.1.1
type MockElicitor struct {
// contains filtered or unexported fields
}
MockElicitor mock implementation of elicitation and sampling
func NewMockElicitor ¶ added in v1.1.1
func NewMockElicitor(handler func(ctx context.Context, method string, params interface{}) (*protocol.ElicitationResult, error)) *MockElicitor
NewMockElicitor creates a mock elicitation handler
func NewMockElicitorWithSampling ¶ added in v1.1.1
func NewMockElicitorWithSampling( elicitationHandler func(ctx context.Context, method string, params interface{}) (*protocol.ElicitationResult, error), samplingHandler func(ctx context.Context, request *protocol.CreateMessageRequest) (*protocol.CreateMessageResult, error), ) *MockElicitor
NewMockElicitorWithSampling creates a mock elicitation and sampling handler
func (*MockElicitor) CreateMessage ¶ added in v1.1.1
func (m *MockElicitor) CreateMessage(ctx context.Context, request *protocol.CreateMessageRequest) (*protocol.CreateMessageResult, error)
CreateMessage handles sampling requests (returns mock response)
func (*MockElicitor) Elicit ¶ added in v1.1.1
func (m *MockElicitor) Elicit(ctx context.Context, method string, params interface{}) (*protocol.JSONRPCMessage, error)
Elicit handles elicitation requests (returns mock response)
type PromptBuilder ¶
type PromptBuilder struct {
// contains filtered or unexported fields
}
func (*PromptBuilder) Handle ¶
func (pb *PromptBuilder) Handle(handler PromptHandler) error
Handle registers prompt template handler
func (*PromptBuilder) WithArgument ¶
func (pb *PromptBuilder) WithArgument(name, description string, required bool) *PromptBuilder
WithArgument adds argument
func (*PromptBuilder) WithMeta ¶ added in v1.1.2
func (pb *PromptBuilder) WithMeta(key string, value any) *PromptBuilder
WithMeta sets metadata (MCP 2025-06-18)
func (*PromptBuilder) WithTitle ¶ added in v1.1.2
func (pb *PromptBuilder) WithTitle(title string) *PromptBuilder
WithTitle sets human-friendly title (MCP 2025-06-18)
type PromptHandler ¶
type PromptHandlerWithElicitation ¶ added in v1.1.1
type PromptHandlerWithElicitation func(ctx *MCPContext, arguments map[string]string) (*protocol.GetPromptResult, error)
type PromptOptions ¶ added in v1.1.2
type PromptOptions struct {
Title string // optional human-friendly title (MCP 2025-06-18)
Meta map[string]any // optional metadata (MCP 2025-06-18)
}
PromptOptions prompt registration options
type PromptRegistration ¶
type PromptRegistration struct {
Prompt protocol.Prompt
Handler PromptHandler
}
type ResourceBuilder ¶
type ResourceBuilder struct {
// contains filtered or unexported fields
}
func (*ResourceBuilder) Handle ¶
func (rb *ResourceBuilder) Handle(handler ResourceHandler) error
Handle registers resource handler
func (*ResourceBuilder) WithMeta ¶ added in v1.1.2
func (rb *ResourceBuilder) WithMeta(key string, value any) *ResourceBuilder
WithMeta sets metadata (MCP 2025-06-18)
func (*ResourceBuilder) WithMimeType ¶
func (rb *ResourceBuilder) WithMimeType(mimeType string) *ResourceBuilder
WithMimeType sets MIME type
type ResourceHandler ¶
type ResourceHandler func(ctx context.Context) (*protocol.ReadResourceResult, error)
type ResourceHandlerWithElicitation ¶ added in v1.1.1
type ResourceHandlerWithElicitation func(ctx *MCPContext) (*protocol.ReadResourceResult, error)
type ResourceRegistration ¶
type ResourceRegistration struct {
Resource protocol.Resource
Handler ResourceHandler
}
type ResourceTemplateBuilder ¶ added in v1.1.2
type ResourceTemplateBuilder struct {
// contains filtered or unexported fields
}
func (*ResourceTemplateBuilder) Register ¶ added in v1.1.2
func (rtb *ResourceTemplateBuilder) Register() error
Register registers resource template metadata
func (*ResourceTemplateBuilder) WithMeta ¶ added in v1.1.2
func (rtb *ResourceTemplateBuilder) WithMeta(key string, value any) *ResourceTemplateBuilder
WithMeta sets metadata (MCP 2025-06-18)
func (*ResourceTemplateBuilder) WithMimeType ¶ added in v1.1.2
func (rtb *ResourceTemplateBuilder) WithMimeType(mimeType string) *ResourceTemplateBuilder
WithMimeType sets MIME type for resource template
type ResourceTemplateRegistration ¶ added in v1.1.2
type ResourceTemplateRegistration struct {
Template protocol.ResourceTemplate
}
type Server ¶
type Server interface {
RegisterTool(name, description string, inputSchema protocol.JSONSchema, handler ToolHandler) error
UnregisterTool(name string) error
RegisterResource(uri, name, description, mimeType string, handler ResourceHandler) error
UnregisterResource(uri string) error
RegisterPrompt(name, description string, arguments []protocol.PromptArgument, handler PromptHandler) error
UnregisterPrompt(name string) error
GetServerInfo() protocol.ServerInfo
GetCapabilities() protocol.ServerCapabilities
HandleMessage(ctx context.Context, message *protocol.JSONRPCMessage) (*protocol.JSONRPCMessage, error)
SendNotification(method string, params interface{}) error
RequestRootsList(ctx context.Context) (*protocol.ListRootsResult, error)
}
type ToolBuilder ¶
type ToolBuilder struct {
// contains filtered or unexported fields
}
func (*ToolBuilder) Handle ¶
func (tb *ToolBuilder) Handle(handler ToolHandler) error
Handle registers tool handler
func (*ToolBuilder) HandleWithElicitation ¶ added in v1.1.1
func (tb *ToolBuilder) HandleWithElicitation(handler ToolHandlerWithElicitation) error
HandleWithElicitation registers tool handler with elicitation support
func (*ToolBuilder) HandleWithValidation ¶
func (tb *ToolBuilder) HandleWithValidation(handler ToolHandler) error
HandleWithValidation tool handler with validation
func (*ToolBuilder) WithBoolParam ¶
func (tb *ToolBuilder) WithBoolParam(name, description string, required bool) *ToolBuilder
WithBoolParam adds boolean parameter
func (*ToolBuilder) WithInputSchema ¶
func (tb *ToolBuilder) WithInputSchema(schema protocol.JSONSchema) *ToolBuilder
WithInputSchema sets custom input schema
func (*ToolBuilder) WithIntParam ¶
func (tb *ToolBuilder) WithIntParam(name, description string, required bool) *ToolBuilder
WithIntParam adds integer parameter
func (*ToolBuilder) WithMeta ¶ added in v1.1.2
func (tb *ToolBuilder) WithMeta(key string, value interface{}) *ToolBuilder
WithMeta sets metadata (MCP 2025-06-18)
func (*ToolBuilder) WithNumberParam ¶
func (tb *ToolBuilder) WithNumberParam(name, description string, required bool) *ToolBuilder
WithNumberParam adds number parameter (supports integers and floats)
func (*ToolBuilder) WithOutputSchema ¶ added in v1.1.0
func (tb *ToolBuilder) WithOutputSchema(schema protocol.JSONSchema) *ToolBuilder
WithOutputSchema sets output schema (MCP 2025-06-18)
func (*ToolBuilder) WithStringParam ¶
func (tb *ToolBuilder) WithStringParam(name, description string, required bool) *ToolBuilder
func (*ToolBuilder) WithStructOutputSchema ¶ added in v1.1.0
func (tb *ToolBuilder) WithStructOutputSchema(v interface{}) *ToolBuilder
WithStructOutputSchema automatically generates output schema using struct
func (*ToolBuilder) WithStructSchema ¶
func (tb *ToolBuilder) WithStructSchema(v interface{}) *ToolBuilder
WithStructSchema automatically generates schema using struct
func (*ToolBuilder) WithTitle ¶ added in v1.1.2
func (tb *ToolBuilder) WithTitle(title string) *ToolBuilder
WithTitle sets human-friendly title (MCP 2025-06-18)
type ToolHandler ¶
type ToolHandlerWithElicitation ¶ added in v1.1.1
type ToolHandlerWithElicitation func(ctx *MCPContext, arguments map[string]interface{}) (*protocol.CallToolResult, error)
type ToolOptions ¶ added in v1.1.0
type ToolOptions struct {
Title string // optional human-friendly title (MCP 2025-06-18)
OutputSchema protocol.JSONSchema // optional output schema (MCP 2025-06-18)
Meta map[string]any // optional metadata (MCP 2025-06-18)
}
ToolOptions tool registration options
type ToolRegistration ¶
type ToolRegistration struct {
Tool protocol.Tool
Handler ToolHandler
}
type TransportElicitor ¶ added in v1.1.1
type TransportElicitor struct {
// contains filtered or unexported fields
}
TransportElicitor implementation that sends requests through transport layer
func NewTransportElicitor ¶ added in v1.1.1
func NewTransportElicitor(sendMessage func(ctx context.Context, message *protocol.JSONRPCMessage) (*protocol.JSONRPCMessage, error)) *TransportElicitor
NewTransportElicitor creates a transport layer elicitation handler
func (*TransportElicitor) CreateMessage ¶ added in v1.1.1
func (t *TransportElicitor) CreateMessage(ctx context.Context, request *protocol.CreateMessageRequest) (*protocol.CreateMessageResult, error)
CreateMessage sends sampling requests through transport layer
func (*TransportElicitor) Elicit ¶ added in v1.1.1
func (t *TransportElicitor) Elicit(ctx context.Context, method string, params interface{}) (*protocol.JSONRPCMessage, error)
Elicit sends elicitation requests through transport layer