resource

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package resource implements the get-resource MCP tool that exposes TheHive's hierarchical resources (schemas, metadata, docs, config) to clients.

Index

Constants

View Source
const GetResourceToolDescription = `` /* 1452-byte string literal not displayed */

GetResourceToolDescription is the human-readable description advertised for the get-resource tool.

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryBrowse added in v0.3.1

type CategoryBrowse struct {
	URI           string           `json:"uri"`
	Subcategories []map[string]any `json:"subcategories,omitempty"`
	Resources     []map[string]any `json:"resources,omitempty"`
}

CategoryBrowse represents a directory listing of resources and subcategories

func NewCategoryBrowse added in v0.3.1

func NewCategoryBrowse(uri string, subcategories []map[string]any, resources []map[string]any) *CategoryBrowse

NewCategoryBrowse creates a CategoryBrowse listing for the given uri.

type Content added in v1.0.0

type Content struct {
	URI      string `json:"uri"`
	Name     string `json:"name"`
	MIMEType string `json:"mimeType,omitempty"`
	Content  string `json:"content,omitempty"`
	Data     any    `json:"data,omitempty"`
}

Content represents a specific resource with its content.

func NewResourceContent added in v0.3.1

func NewResourceContent(uri, name, mimeType string) *Content

NewResourceContent creates a Content for the resource identified by uri.

func (*Content) SetDataContent added in v1.0.0

func (rc *Content) SetDataContent(data any) *Content

SetDataContent sets the structured data body of the resource and returns rc for chaining.

func (*Content) SetTextContent added in v1.0.0

func (rc *Content) SetTextContent(content string) *Content

SetTextContent sets the plain-text body of the resource and returns rc for chaining.

type GetResourceParams added in v0.3.1

type GetResourceParams struct {
	URI string `` /* 157-byte string literal not displayed */
}

GetResourceParams defines the input parameters for the get-resource tool

type GetResourceResult added in v0.3.1

type GetResourceResult struct {
	Resource *Content        `json:"resource,omitempty"`
	Category *CategoryBrowse `json:"category,omitempty"`
}

GetResourceResult is the unified response type for get-resource operations Either Resource OR Category will be populated, never both

func NewCategoryResult added in v0.3.1

func NewCategoryResult(category *CategoryBrowse) *GetResourceResult

NewCategoryResult wraps a category listing in a GetResourceResult.

func NewResourceResult added in v0.3.1

func NewResourceResult(resource *Content) *GetResourceResult

NewResourceResult wraps resource content in a GetResourceResult.

func (GetResourceResult) Unwrap added in v0.3.1

func (r GetResourceResult) Unwrap() any

Unwrap implements utils.Unwrapper to flatten the union for serialization.

type Tool added in v1.0.0

type Tool struct {
	// contains filtered or unexported fields
}

Tool is the get-resource MCP tool backed by a resource registry.

func NewResourceTool

func NewResourceTool(registry *resources.ResourceRegistry) *Tool

NewResourceTool creates a Tool serving resources from the given registry.

func (*Tool) Definition added in v1.0.0

func (t *Tool) Definition() mcp.Tool

Definition returns the tool's MCP definition, including input and output schemas.

func (*Tool) Handle added in v1.0.0

Handle fetches the resource or category identified by params.URI.

func (*Tool) Handler added in v1.0.0

func (t *Tool) Handler() server.ToolHandlerFunc

Handler returns the validated MCP handler for the tool.

func (*Tool) Name added in v1.0.0

func (t *Tool) Name() string

Name returns the tool's registered name.

func (*Tool) ValidateParams added in v1.0.0

func (t *Tool) ValidateParams(params *GetResourceParams) error

ValidateParams applies defaults and normalizes the requested URI in place.

func (*Tool) ValidatePermissions added in v1.0.0

func (t *Tool) ValidatePermissions(ctx context.Context, _ GetResourceParams) error

ValidatePermissions verifies the caller is allowed to use the get-resource tool.

Jump to

Keyboard shortcuts

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