Documentation
¶
Index ¶
- Constants
- func NewDateAwareHandler[TParams, TResult any](...) server.ToolHandlerFunc
- func WithValidation[TParams, TResult any](tool Tool[TParams, TResult]) server.ToolHandlerFunc
- type BaseTool
- type Registry
- type Tool
- type ToolError
- func (e *ToolError) API(resp *http.Response) *ToolError
- func (e *ToolError) Cause(err error) *ToolError
- func (e *ToolError) Error() string
- func (e *ToolError) Hint(hint string) *ToolError
- func (e *ToolError) Hintf(format string, args ...interface{}) *ToolError
- func (e *ToolError) Schema(entityType, operation string) *ToolError
- func (e *ToolError) ToMap() map[string]interface{}
- func (e *ToolError) Unwrap() error
- type UntrustedDataSource
Constants ¶
const ( ToolNameManageEntities = "manage-entities" ToolNameExecuteAutomation = "execute-automation" ToolNameGetResource = "get-resource" ToolNameSearchEntities = "search-entities" )
Variables ¶
This section is empty.
Functions ¶
func NewDateAwareHandler ¶ added in v0.3.1
func NewDateAwareHandler[TParams, TResult any](handler func(ctx context.Context, req mcp.CallToolRequest, args TParams) (TResult, error), wrapUntrusted bool) server.ToolHandlerFunc
NewDateAwareHandler creates a handler with automatic date processing for any result type. When wrapUntrusted is true, user-generated fields in the result are wrapped with boundary tags.
func WithValidation ¶ added in v0.3.1
func WithValidation[TParams, TResult any](tool Tool[TParams, TResult]) server.ToolHandlerFunc
WithValidation wraps a tool's Handler with validation and date processing
Types ¶
type BaseTool ¶ added in v0.3.1
type BaseTool interface {
Name() string
Definition() mcp.Tool
Handler() server.ToolHandlerFunc
}
BaseTool is the non-generic interface for tool registration
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages tool registration
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) RegisterAll ¶
type Tool ¶
type Tool[TParams, TResult any] interface { BaseTool Handle(ctx context.Context, request mcp.CallToolRequest, params TParams) (TResult, error) ValidateParams(params *TParams) error ValidatePermissions(ctx context.Context, params TParams) error }
Tool represents an MCP tool with typed parameters
type ToolError ¶ added in v0.3.1
type ToolError struct {
// contains filtered or unexported fields
}
Error represents a tool error with optional context
func NewToolError ¶ added in v0.3.1
New creates a new tool error
func NewToolErrorf ¶ added in v0.3.1
Newf creates a new tool error with formatting
func (*ToolError) API ¶ added in v0.3.1
API adds the API response for debugging Note: This method consumes and closes the response body
type UntrustedDataSource ¶ added in v0.3.4
type UntrustedDataSource interface {
HasUntrustedData() bool
}
UntrustedDataSource is an optional interface implemented by tools whose responses contain user-generated data from external systems (e.g. TheHive). When implemented and returning true, the middleware wraps designated fields with [UNTRUSTED_DATA] boundary tags to help LLM clients distinguish data from instructions.