Documentation
¶
Overview ¶
Package tools defines the MCP tools exposed by the server and their shared registration, validation, and error-handling helpers.
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 ...any) *ToolError
- func (e *ToolError) Schema(entityType, operation string) *ToolError
- func (e *ToolError) ToMap() map[string]any
- func (e *ToolError) Unwrap() error
- type UntrustedDataReporter
Constants ¶
const ( ToolNameManageEntities = "manage-entities" ToolNameExecuteAutomation = "execute-automation" ToolNameGetResource = "get-resource" ToolNameSearchEntities = "search-entities" )
Tool name constants identify the MCP tools exposed by the server.
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 date-processes the result; when wrapUntrusted is true, user-generated fields are wrapped in boundary tags.
func WithValidation ¶ added in v0.3.1
func WithValidation[TParams, TResult any](tool Tool[TParams, TResult]) server.ToolHandlerFunc
WithValidation runs ValidateParams then ValidatePermissions before Handle, then date-processes the result.
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 (*Registry) RegisterAll ¶
RegisterAll registers every tool in the registry with the given MCP server.
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
}
ToolError represents a tool error with optional context.
func NewToolError ¶ added in v0.3.1
NewToolError creates a new tool error.
func NewToolErrorf ¶ added in v0.3.1
NewToolErrorf creates a new tool error with formatting.
func (*ToolError) API ¶ added in v0.3.1
API attaches resp's body to the error; consumes and closes it.
type UntrustedDataReporter ¶ added in v1.0.0
type UntrustedDataReporter interface {
HasUntrustedData() bool
}
UntrustedDataReporter is an optional interface implemented by tools whose responses carry user-generated data from external systems (e.g. TheHive). When implemented and returning true, the middleware wraps designated fields in [UNTRUSTED_DATA] boundary tags so LLM clients can distinguish data from instructions.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package execute_automation implements the execute-automation MCP tool for running Cortex analyzers and responders and reading their execution status.
|
Package execute_automation implements the execute-automation MCP tool for running Cortex analyzers and responders and reading their execution status. |
|
Package manage implements the manage-entities MCP tool, exposing CRUD and workflow operations (create, update, delete, comment, promote, merge, apply-template) over TheHive entities.
|
Package manage implements the manage-entities MCP tool, exposing CRUD and workflow operations (create, update, delete, comment, promote, merge, apply-template) over TheHive entities. |
|
Package resource implements the get-resource MCP tool that exposes TheHive's hierarchical resources (schemas, metadata, docs, config) to clients.
|
Package resource implements the get-resource MCP tool that exposes TheHive's hierarchical resources (schemas, metadata, docs, config) to clients. |
|
Package search implements the MCP search tool that queries TheHive entities using the TheHive filter DSL.
|
Package search implements the MCP search tool that queries TheHive entities using the TheHive filter DSL. |