Documentation
¶
Overview ¶
Package search implements the MCP search tool that queries TheHive entities using the TheHive filter DSL.
Index ¶
- Constants
- type EntitiesParams
- type EntitiesResult
- type Tool
- func (t *Tool) Definition() mcp.Tool
- func (t *Tool) Handle(ctx context.Context, req mcp.CallToolRequest, params EntitiesParams) (EntitiesResult, error)
- func (t *Tool) Handler() server.ToolHandlerFunc
- func (t *Tool) HasUntrustedData() bool
- func (t *Tool) Name() string
- func (t *Tool) ValidateParams(params *EntitiesParams) error
- func (t *Tool) ValidatePermissions(ctx context.Context, _ EntitiesParams) error
Constants ¶
const SearchEntitiesToolDescription = `` /* 3122-byte string literal not displayed */
SearchEntitiesToolDescription is the MCP tool description shown to the model.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntitiesParams ¶ added in v1.0.0
type EntitiesParams struct {
EntityType string `` /* 1087-byte string literal not displayed */
Filters map[string]any `` /* 348-byte string literal not displayed */
SortBy string `` /* 1136-byte string literal not displayed */
SortOrder string `` /* 1106-byte string literal not displayed */
Limit int `` /* 1131-byte string literal not displayed */
ExtraColumns []string `` /* 292-byte string literal not displayed */
ExtraData []string `` /* 198-byte string literal not displayed */
AdditionalQueries []string `` /* 1032-byte string literal not displayed */
Count bool `` /* 149-byte string literal not displayed */
}
EntitiesParams holds the input parameters of the search tool.
type EntitiesResult ¶ added in v1.0.0
type EntitiesResult struct {
Count int `json:"count"`
CountOnly bool `json:"countOnly"`
EntityType string `json:"entityType"`
Results []map[string]any `json:"results,omitempty"`
RawFilters map[string]any `json:"rawFilters"`
}
EntitiesResult holds the output of the search tool.
func NewSearchEntitiesResult ¶ added in v0.3.1
func NewSearchEntitiesResult(results []map[string]any, params EntitiesParams, filters map[string]any) (EntitiesResult, error)
NewSearchEntitiesResult builds an EntitiesResult from raw query results, deriving the count from the special count entry when params.Count is set.
type Tool ¶ added in v1.0.0
type Tool struct{}
Tool is the MCP tool that searches TheHive entities.
func (*Tool) Definition ¶ added in v1.0.0
Definition returns the MCP tool definition.
func (*Tool) Handle ¶ added in v1.0.0
func (t *Tool) Handle(ctx context.Context, req mcp.CallToolRequest, params EntitiesParams) (EntitiesResult, error)
Handle executes an entity search: it applies permission filters, builds and runs the TheHive query, optionally enriches results with additional queries, and formats them into an EntitiesResult.
func (*Tool) Handler ¶ added in v1.0.0
func (t *Tool) Handler() server.ToolHandlerFunc
Handler returns the validated MCP tool handler.
func (*Tool) HasUntrustedData ¶ added in v1.0.0
HasUntrustedData reports that results may contain untrusted user data.
func (*Tool) ValidateParams ¶ added in v1.0.0
func (t *Tool) ValidateParams(params *EntitiesParams) error
ValidateParams applies defaults and validates the search parameters in place.
func (*Tool) ValidatePermissions ¶ added in v1.0.0
func (t *Tool) ValidatePermissions(ctx context.Context, _ EntitiesParams) error
ValidatePermissions checks that the caller is allowed to use the search tool.