tools

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ToolEventProgress = "progress" // Progress update (percentage)
	ToolEventOutput   = "output"   // Streaming output (like agent response)
	ToolEventLog      = "log"      // Log/status message
	ToolEventChunk    = "chunk"    // Raw chunk (for sub-agent streaming)
	ToolEventError    = "error"    // Non-fatal error/warning
)

Event type constants

View Source
const TestModeContextKey contextKey = "test_mode"

TestModeContextKey is used to carry per-request test mode (e.g. from A2A callers).

Variables

This section is empty.

Functions

func CleanupCollector added in v1.43.0

func CleanupCollector(parentThreadID string)

CleanupCollector removes the collector for a parent thread

func CloseOperatorSession

func CloseOperatorSession(sessionID string) map[string]interface{}

CloseOperatorSession closes an operator session

func ConnectOperatorSession added in v1.52.0

func ConnectOperatorSession(sessionID string) map[string]interface{}

ConnectOperatorSession connects to an existing browser session by ID.

func CreateOperatorSession

func CreateOperatorSession(url, name string, proxy *bool, proxyCountry string) map[string]interface{}

CreateOperatorSession creates a new operator session for a given URL. proxy: nil = use config default (true if unset), ptr to bool for explicit override proxyCountry: empty = use config default, non-empty = override

func CreateTaskTool

func CreateTaskTool(input map[string]interface{}) (map[string]interface{}, error)

CreateTaskTool creates a new task

func DeleteFile

func DeleteFile(fileID string) map[string]interface{}

DeleteFile deletes a specific file

func DeleteTaskTool

func DeleteTaskTool(input map[string]interface{}) (map[string]interface{}, error)

DeleteTaskTool deletes a task

func ExecuteTaskTool

func ExecuteTaskTool(input map[string]interface{}) (map[string]interface{}, error)

ExecuteTaskTool executes a task and stores result

func ExecuteTaskToolStreaming

func ExecuteTaskToolStreaming(input map[string]interface{}, callback StreamCallback) (map[string]interface{}, error)

ExecuteTaskToolStreaming executes a task with streaming output

func ExecuteWithContext added in v1.34.0

func ExecuteWithContext(ctx context.Context, tool Tool, params map[string]interface{}) (interface{}, error)

ExecuteWithContext executes a tool with cancellation support. If the context is cancelled before execution starts, returns immediately. The tool execution itself runs in a goroutine so cancellation can interrupt the wait.

func ExecuteWithStreaming

func ExecuteWithStreaming(tool Tool, params map[string]interface{}, callback StreamCallback) (interface{}, error)

ExecuteWithStreaming executes a tool, using streaming if supported If the tool doesn't support streaming, it falls back to regular Execute

func ExecuteWithStreamingContext added in v1.34.0

func ExecuteWithStreamingContext(ctx context.Context, tool Tool, params map[string]interface{}, callback StreamCallback) (interface{}, error)

ExecuteWithStreamingContext executes a streaming tool with cancellation support.

func FormatPendingResults added in v1.43.0

func FormatPendingResults(results []SubThreadResult) string

FormatPendingResults formats background task results for injection into the LLM conversation

func GenerateToolManifest

func GenerateToolManifest(allTools []ToolDefinition) string

GenerateToolManifest creates a concise list of all available tools for system prompt injection

func GetDisplayName

func GetDisplayName(name string) string

GetDisplayName returns the display name for a built-in tool Returns empty string if tool not found (caller should check MCP tools or use fallback)

func GetDynamicDisplayName added in v1.37.0

func GetDynamicDisplayName(name string, params map[string]interface{}) string

GetDynamicDisplayName returns a context-specific display name for a tool if it supports it. Returns empty string if the tool doesn't implement DynamicDisplayNameProvider or isn't found.

func GetFile

func GetFile(fileID string) map[string]interface{}

GetFile gets file metadata and public URL by ID

func GetSetupModeSystemPromptPrefix

func GetSetupModeSystemPromptPrefix(cfg *config.AgentConfig) string

GetSetupModeSystemPromptPrefix returns the prefix to inject when in setup mode

func GetSummary

func GetSummary(tool Tool) string

GetSummary extracts first sentence from tool description for manifests

func GetTaskTool

func GetTaskTool(input map[string]interface{}) (map[string]interface{}, error)

GetTaskTool gets detailed information about a task

func InitToolLoader

func InitToolLoader(cfg *config.ToolLoadingConfig)

InitToolLoader initializes the global tool loader

func IsCronExpression

func IsCronExpression(recurrence string) bool

IsCronExpression checks if recurrence is a cron expression

func IsMCPReadOnly added in v1.55.0

func IsMCPReadOnly(toolName string) bool

IsMCPReadOnly determines if an MCP tool name looks like a read-only operation. Read-only MCP tools execute for real in test mode, returning actual data. Write operations (create, update, delete, send, etc.) are mocked.

func IsStreamingTool

func IsStreamingTool(tool Tool) bool

IsStreamingTool checks if a tool supports streaming

func IsTestModeActive added in v1.48.0

func IsTestModeActive(ctx context.Context) bool

IsTestModeActive checks whether test mode is active, either via per-request context (from A2A caller header) or global config.

func IsThreadActive added in v1.43.0

func IsThreadActive(threadID string) bool

IsThreadActive returns true if the thread is currently in a conversation loop

func ListFiles

func ListFiles(threadID, fileType string, limit int) map[string]interface{}

ListFiles lists files in storage with optional filters

func ListOperatorSessions

func ListOperatorSessions(status string) map[string]interface{}

ListOperatorSessions lists all active operator sessions from the provider

func ListTasksTool

func ListTasksTool(input map[string]interface{}) (map[string]interface{}, error)

ListTasksTool lists tasks with filters

func MCPWebhooksListTool

func MCPWebhooksListTool(input map[string]interface{}) (map[string]interface{}, error)

MCPWebhooksListTool lists available webhook servers from config

func MarkThreadActive added in v1.43.0

func MarkThreadActive(threadID string)

MarkThreadActive marks a thread as currently in a conversation loop

func MarkThreadIdle added in v1.43.0

func MarkThreadIdle(threadID string)

MarkThreadIdle marks a thread as no longer in a conversation loop

func PostChatAsync added in v1.43.0

func PostChatAsync(threadID, message, source string)

PostChatAsync fires a /chat request to the agent's own endpoint (fire-and-forget) Used to deliver background task results to an idle parent thread

func RecallTool added in v1.55.0

func RecallTool(input map[string]interface{}) (interface{}, error)

RecallTool searches memories and/or past conversations.

func RegisterBrowserTool

func RegisterBrowserTool()

RegisterBrowserTool registers the browser tool in the global registry. Called from main.go when operator mode is enabled (all providers). Idempotent — safe to call multiple times (e.g. on config changes).

func RegisterConfigTools

func RegisterConfigTools()

RegisterConfigTools registers the config tools with the global registry

func RegisterFilesystemTools

func RegisterFilesystemTools()

RegisterFilesystemTools registers all filesystem tools

func RegisterOperatorSessionTools

func RegisterOperatorSessionTools()

RegisterOperatorSessionTools registers all operator session tools

func RegisterRecallTool added in v1.55.0

func RegisterRecallTool()

RegisterRecallTool registers the recall tool in the global registry.

func RegisterSubscriptionTools

func RegisterSubscriptionTools()

RegisterSubscriptionTools registers all subscription management tools

func RegisterTaskTools

func RegisterTaskTools()

RegisterTaskTools registers all task management tools

func RegisterWaitTool

func RegisterWaitTool()

RegisterWaitTool registers the wait tool in the global registry

func SanitizeSchemaForAnthropic added in v1.33.73

func SanitizeSchemaForAnthropic(schema map[string]interface{}) map[string]interface{}

SanitizeSchemaForAnthropic removes or transforms schema constructs not supported by Anthropic Anthropic doesn't support oneOf, allOf, or anyOf at the top level of input_schema

func SanitizeToolName added in v1.33.51

func SanitizeToolName(name string) string

SanitizeToolName ensures a tool name matches the Anthropic API pattern ^[a-zA-Z0-9_-]{1,128}$ Invalid characters are replaced with underscores, and the name is truncated to 128 chars

func SearchFiles

func SearchFiles(query, fileType string, limit int) map[string]interface{}

SearchFiles searches files by query

func SetFileManager

func SetFileManager(fm *filesystem.FileManager)

SetFileManager sets the global file manager for filesystem tools

func SetPendingURL

func SetPendingURL(url string)

SetPendingURL stores a URL to be used when creating the next session

func SetRecallDeps added in v1.55.0

func SetRecallDeps(db *sql.DB, mm *memory.MemoryManager)

SetRecallDeps sets the database and memory manager for the recall tool.

func SetTaskDB

func SetTaskDB(db *sql.DB)

SetTaskDB sets the database connection for task operations

func ShouldInterceptInTestMode added in v1.48.0

func ShouldInterceptInTestMode(toolName string) bool

ShouldInterceptInTestMode returns true if this tool should be mocked in test mode. Read-only tools and agent calls execute for real.

func SimulateMCPToolResult added in v1.48.0

func SimulateMCPToolResult(toolName string, input map[string]interface{}) string

SimulateMCPToolResult returns a mock result for a write/mutating MCP tool in test mode. Read-only MCP tools should not reach here — they execute for real.

func SimulateToolResult added in v1.48.0

func SimulateToolResult(toolName string, input map[string]interface{}) (interface{}, error)

SimulateToolResult returns a plausible mock result for a tool call in test mode. Only called for write/mutating tools — read-only tools execute for real.

func SubscribeTool

func SubscribeTool(input map[string]interface{}) (map[string]interface{}, error)

SubscribeTool creates or updates a webhook subscription via backend API

func SubscriptionsListTool

func SubscriptionsListTool(input map[string]interface{}) (map[string]interface{}, error)

SubscriptionsListTool lists all active subscriptions via backend API

func UnsubscribeTool

func UnsubscribeTool(input map[string]interface{}) (map[string]interface{}, error)

UnsubscribeTool removes a subscription via backend API

func UpdateSubscriptionTool

func UpdateSubscriptionTool(input map[string]interface{}) (map[string]interface{}, error)

UpdateSubscriptionTool updates an existing subscription via backend API

func UpdateTaskTool

func UpdateTaskTool(input map[string]interface{}) (map[string]interface{}, error)

UpdateTaskTool updates task properties

func ValidateRecurrence

func ValidateRecurrence(recurrence string) error

ValidateRecurrence validates a recurrence pattern (simple or cron expression)

Types

type AnalyzeImageURLTool

type AnalyzeImageURLTool struct{}

func (*AnalyzeImageURLTool) Description

func (t *AnalyzeImageURLTool) Description() string

func (*AnalyzeImageURLTool) DisplayName

func (t *AnalyzeImageURLTool) DisplayName() string

func (*AnalyzeImageURLTool) Execute

func (t *AnalyzeImageURLTool) Execute(params map[string]interface{}) (interface{}, error)

func (*AnalyzeImageURLTool) InputSchema

func (t *AnalyzeImageURLTool) InputSchema() map[string]interface{}

func (*AnalyzeImageURLTool) Name

func (t *AnalyzeImageURLTool) Name() string

type BM25Index

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

BM25Index implements BM25 ranking for tool relevance scoring

func NewBM25Index

func NewBM25Index(registry *Registry) *BM25Index

NewBM25Index creates a new BM25 index from the tool registry

func NewBM25IndexFromTools

func NewBM25IndexFromTools(tools []ToolDefinition) *BM25Index

NewBM25IndexFromTools creates a new BM25 index from a list of tool definitions

func (*BM25Index) GetTopK

func (idx *BM25Index) GetTopK(query string, k int, threshold float64, allTools []ToolDefinition) []ToolDefinition

GetTopK returns the top K tools above the threshold for a query

func (*BM25Index) RebuildIndex

func (idx *BM25Index) RebuildIndex(registry *Registry)

RebuildIndex rebuilds the BM25 index (call after adding new tools)

type BrowserTool

type BrowserTool struct{}

BrowserTool provides browser control for non-Claude models with vision capabilities. This is equivalent to Claude's built-in "computer" tool but works with any model.

func (*BrowserTool) Description

func (t *BrowserTool) Description() string

func (*BrowserTool) DisplayName

func (t *BrowserTool) DisplayName() string

func (*BrowserTool) Execute

func (t *BrowserTool) Execute(params map[string]interface{}) (interface{}, error)

func (*BrowserTool) InputSchema

func (t *BrowserTool) InputSchema() map[string]interface{}

func (*BrowserTool) Name

func (t *BrowserTool) Name() string

type CloseOperatorSessionToolWrapper

type CloseOperatorSessionToolWrapper struct{}

CloseOperatorSessionToolWrapper wraps the close operator session function

func (*CloseOperatorSessionToolWrapper) Description

func (t *CloseOperatorSessionToolWrapper) Description() string

func (*CloseOperatorSessionToolWrapper) DisplayName

func (t *CloseOperatorSessionToolWrapper) DisplayName() string

func (*CloseOperatorSessionToolWrapper) Execute

func (t *CloseOperatorSessionToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*CloseOperatorSessionToolWrapper) InputSchema

func (t *CloseOperatorSessionToolWrapper) InputSchema() map[string]interface{}

func (*CloseOperatorSessionToolWrapper) Name

type ConfigSetTool

type ConfigSetTool struct{}

ConfigSetTool allows the agent to modify its own configuration

func (*ConfigSetTool) Description

func (t *ConfigSetTool) Description() string

func (*ConfigSetTool) DisplayName

func (t *ConfigSetTool) DisplayName() string

func (*ConfigSetTool) Execute

func (t *ConfigSetTool) Execute(params map[string]interface{}) (interface{}, error)

func (*ConfigSetTool) InputSchema

func (t *ConfigSetTool) InputSchema() map[string]interface{}

func (*ConfigSetTool) Name

func (t *ConfigSetTool) Name() string

type ConnectOperatorSessionToolWrapper added in v1.52.0

type ConnectOperatorSessionToolWrapper struct{}

ConnectOperatorSessionToolWrapper wraps the connect operator session function

func (*ConnectOperatorSessionToolWrapper) Description added in v1.52.0

func (t *ConnectOperatorSessionToolWrapper) Description() string

func (*ConnectOperatorSessionToolWrapper) DisplayName added in v1.52.0

func (t *ConnectOperatorSessionToolWrapper) DisplayName() string

func (*ConnectOperatorSessionToolWrapper) Execute added in v1.52.0

func (t *ConnectOperatorSessionToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*ConnectOperatorSessionToolWrapper) InputSchema added in v1.52.0

func (t *ConnectOperatorSessionToolWrapper) InputSchema() map[string]interface{}

func (*ConnectOperatorSessionToolWrapper) Name added in v1.52.0

type CreateOperatorSessionToolWrapper

type CreateOperatorSessionToolWrapper struct{}

CreateOperatorSessionToolWrapper wraps the create operator session function

func (*CreateOperatorSessionToolWrapper) Description

func (t *CreateOperatorSessionToolWrapper) Description() string

func (*CreateOperatorSessionToolWrapper) DisplayName

func (t *CreateOperatorSessionToolWrapper) DisplayName() string

func (*CreateOperatorSessionToolWrapper) Execute

func (t *CreateOperatorSessionToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*CreateOperatorSessionToolWrapper) InputSchema

func (t *CreateOperatorSessionToolWrapper) InputSchema() map[string]interface{}

func (*CreateOperatorSessionToolWrapper) Name

type CreateTaskToolWrapper

type CreateTaskToolWrapper struct{}

CreateTaskToolWrapper wraps the create task function

func (*CreateTaskToolWrapper) Description

func (t *CreateTaskToolWrapper) Description() string

func (*CreateTaskToolWrapper) DisplayName

func (t *CreateTaskToolWrapper) DisplayName() string

func (*CreateTaskToolWrapper) Execute

func (t *CreateTaskToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*CreateTaskToolWrapper) InputSchema

func (t *CreateTaskToolWrapper) InputSchema() map[string]interface{}

func (*CreateTaskToolWrapper) Name

func (t *CreateTaskToolWrapper) Name() string

type DeleteFileToolWrapper

type DeleteFileToolWrapper struct{}

DeleteFileToolWrapper wraps the delete file function

func (*DeleteFileToolWrapper) Description

func (t *DeleteFileToolWrapper) Description() string

func (*DeleteFileToolWrapper) DisplayName

func (t *DeleteFileToolWrapper) DisplayName() string

func (*DeleteFileToolWrapper) Execute

func (t *DeleteFileToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*DeleteFileToolWrapper) InputSchema

func (t *DeleteFileToolWrapper) InputSchema() map[string]interface{}

func (*DeleteFileToolWrapper) Name

func (t *DeleteFileToolWrapper) Name() string

type DeleteTaskToolWrapper

type DeleteTaskToolWrapper struct{}

DeleteTaskToolWrapper wraps the delete task function

func (*DeleteTaskToolWrapper) Description

func (t *DeleteTaskToolWrapper) Description() string

func (*DeleteTaskToolWrapper) DisplayName

func (t *DeleteTaskToolWrapper) DisplayName() string

func (*DeleteTaskToolWrapper) Execute

func (t *DeleteTaskToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*DeleteTaskToolWrapper) InputSchema

func (t *DeleteTaskToolWrapper) InputSchema() map[string]interface{}

func (*DeleteTaskToolWrapper) Name

func (t *DeleteTaskToolWrapper) Name() string

type DocumentSearchTool

type DocumentSearchTool struct{}

DocumentSearchTool - A test tool with complex nested filters

func (*DocumentSearchTool) Description

func (t *DocumentSearchTool) Description() string

func (*DocumentSearchTool) DisplayName

func (t *DocumentSearchTool) DisplayName() string

func (*DocumentSearchTool) Execute

func (t *DocumentSearchTool) Execute(params map[string]interface{}) (interface{}, error)

func (*DocumentSearchTool) InputSchema

func (t *DocumentSearchTool) InputSchema() map[string]interface{}

func (*DocumentSearchTool) Name

func (t *DocumentSearchTool) Name() string

type DynamicDisplayNameProvider added in v1.37.0

type DynamicDisplayNameProvider interface {
	DynamicDisplayName(params map[string]interface{}) string
}

DynamicDisplayNameProvider is an optional interface that tools can implement to provide context-specific display names based on their input parameters. For example, call_agent can return "Calling Jarvis" instead of generic "Call Agent".

type ExecuteTaskToolWrapper

type ExecuteTaskToolWrapper struct{}

ExecuteTaskToolWrapper wraps the execute task function with streaming support

func (*ExecuteTaskToolWrapper) Description

func (t *ExecuteTaskToolWrapper) Description() string

func (*ExecuteTaskToolWrapper) DisplayName

func (t *ExecuteTaskToolWrapper) DisplayName() string

func (*ExecuteTaskToolWrapper) Execute

func (t *ExecuteTaskToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

Execute falls back to non-streaming for backwards compatibility

func (*ExecuteTaskToolWrapper) ExecuteStreaming

func (t *ExecuteTaskToolWrapper) ExecuteStreaming(params map[string]interface{}, callback StreamCallback) (interface{}, error)

ExecuteStreaming executes a task with streaming output (only when sync=true)

func (*ExecuteTaskToolWrapper) InputSchema

func (t *ExecuteTaskToolWrapper) InputSchema() map[string]interface{}

func (*ExecuteTaskToolWrapper) Name

func (t *ExecuteTaskToolWrapper) Name() string

func (*ExecuteTaskToolWrapper) SupportsStreaming

func (t *ExecuteTaskToolWrapper) SupportsStreaming() bool

SupportsStreaming returns true - this tool can stream task execution output

type GenerateTestImageTool

type GenerateTestImageTool struct{}

func (*GenerateTestImageTool) Description

func (t *GenerateTestImageTool) Description() string

func (*GenerateTestImageTool) DisplayName

func (t *GenerateTestImageTool) DisplayName() string

func (*GenerateTestImageTool) Execute

func (t *GenerateTestImageTool) Execute(params map[string]interface{}) (interface{}, error)

func (*GenerateTestImageTool) InputSchema

func (t *GenerateTestImageTool) InputSchema() map[string]interface{}

func (*GenerateTestImageTool) Name

func (t *GenerateTestImageTool) Name() string

type GenerateTestPDFTool added in v1.40.0

type GenerateTestPDFTool struct{}

func (*GenerateTestPDFTool) Description added in v1.40.0

func (t *GenerateTestPDFTool) Description() string

func (*GenerateTestPDFTool) DisplayName added in v1.40.0

func (t *GenerateTestPDFTool) DisplayName() string

func (*GenerateTestPDFTool) Execute added in v1.40.0

func (t *GenerateTestPDFTool) Execute(params map[string]interface{}) (interface{}, error)

func (*GenerateTestPDFTool) InputSchema added in v1.40.0

func (t *GenerateTestPDFTool) InputSchema() map[string]interface{}

func (*GenerateTestPDFTool) Name added in v1.40.0

func (t *GenerateTestPDFTool) Name() string

type GetFileToolWrapper

type GetFileToolWrapper struct{}

GetFileToolWrapper wraps the get file function

func (*GetFileToolWrapper) Description

func (t *GetFileToolWrapper) Description() string

func (*GetFileToolWrapper) DisplayName

func (t *GetFileToolWrapper) DisplayName() string

func (*GetFileToolWrapper) Execute

func (t *GetFileToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*GetFileToolWrapper) InputSchema

func (t *GetFileToolWrapper) InputSchema() map[string]interface{}

func (*GetFileToolWrapper) Name

func (t *GetFileToolWrapper) Name() string

type GetTaskToolWrapper

type GetTaskToolWrapper struct{}

GetTaskToolWrapper wraps the get task function

func (*GetTaskToolWrapper) Description

func (t *GetTaskToolWrapper) Description() string

func (*GetTaskToolWrapper) DisplayName

func (t *GetTaskToolWrapper) DisplayName() string

func (*GetTaskToolWrapper) Execute

func (t *GetTaskToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*GetTaskToolWrapper) InputSchema

func (t *GetTaskToolWrapper) InputSchema() map[string]interface{}

func (*GetTaskToolWrapper) Name

func (t *GetTaskToolWrapper) Name() string

type GetTimeTool

type GetTimeTool struct{}

func (*GetTimeTool) Description

func (t *GetTimeTool) Description() string

func (*GetTimeTool) DisplayName

func (t *GetTimeTool) DisplayName() string

func (*GetTimeTool) Execute

func (t *GetTimeTool) Execute(params map[string]interface{}) (interface{}, error)

func (*GetTimeTool) InputSchema

func (t *GetTimeTool) InputSchema() map[string]interface{}

func (*GetTimeTool) Name

func (t *GetTimeTool) Name() string

type HighQualityScreenshotToolWrapper

type HighQualityScreenshotToolWrapper struct{}

HighQualityScreenshotToolWrapper wraps the high quality screenshot function

func (*HighQualityScreenshotToolWrapper) Description

func (t *HighQualityScreenshotToolWrapper) Description() string

func (*HighQualityScreenshotToolWrapper) DisplayName

func (t *HighQualityScreenshotToolWrapper) DisplayName() string

func (*HighQualityScreenshotToolWrapper) Execute

func (t *HighQualityScreenshotToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*HighQualityScreenshotToolWrapper) InputSchema

func (t *HighQualityScreenshotToolWrapper) InputSchema() map[string]interface{}

func (*HighQualityScreenshotToolWrapper) Name

type ListFilesToolWrapper

type ListFilesToolWrapper struct{}

ListFilesToolWrapper wraps the list files function

func (*ListFilesToolWrapper) Description

func (t *ListFilesToolWrapper) Description() string

func (*ListFilesToolWrapper) DisplayName

func (t *ListFilesToolWrapper) DisplayName() string

func (*ListFilesToolWrapper) Execute

func (t *ListFilesToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*ListFilesToolWrapper) InputSchema

func (t *ListFilesToolWrapper) InputSchema() map[string]interface{}

func (*ListFilesToolWrapper) Name

func (t *ListFilesToolWrapper) Name() string

type ListOperatorSessionsToolWrapper

type ListOperatorSessionsToolWrapper struct{}

ListOperatorSessionsToolWrapper wraps the list operator sessions function

func (*ListOperatorSessionsToolWrapper) Description

func (t *ListOperatorSessionsToolWrapper) Description() string

func (*ListOperatorSessionsToolWrapper) DisplayName

func (t *ListOperatorSessionsToolWrapper) DisplayName() string

func (*ListOperatorSessionsToolWrapper) Execute

func (t *ListOperatorSessionsToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*ListOperatorSessionsToolWrapper) InputSchema

func (t *ListOperatorSessionsToolWrapper) InputSchema() map[string]interface{}

func (*ListOperatorSessionsToolWrapper) Name

type ListTasksToolWrapper

type ListTasksToolWrapper struct{}

ListTasksToolWrapper wraps the list tasks function

func (*ListTasksToolWrapper) Description

func (t *ListTasksToolWrapper) Description() string

func (*ListTasksToolWrapper) DisplayName

func (t *ListTasksToolWrapper) DisplayName() string

func (*ListTasksToolWrapper) Execute

func (t *ListTasksToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*ListTasksToolWrapper) InputSchema

func (t *ListTasksToolWrapper) InputSchema() map[string]interface{}

func (*ListTasksToolWrapper) Name

func (t *ListTasksToolWrapper) Name() string

type MCPWebhooksListToolWrapper

type MCPWebhooksListToolWrapper struct{}

MCPWebhooksListToolWrapper wraps the mcp_webhooks_list function

func (*MCPWebhooksListToolWrapper) Description

func (t *MCPWebhooksListToolWrapper) Description() string

func (*MCPWebhooksListToolWrapper) DisplayName

func (t *MCPWebhooksListToolWrapper) DisplayName() string

func (*MCPWebhooksListToolWrapper) Execute

func (t *MCPWebhooksListToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*MCPWebhooksListToolWrapper) InputSchema

func (t *MCPWebhooksListToolWrapper) InputSchema() map[string]interface{}

func (*MCPWebhooksListToolWrapper) Name

type PingTool added in v1.33.41

type PingTool struct{}

PingTool is a simple tool with no inputs for testing

func (*PingTool) Description added in v1.33.41

func (t *PingTool) Description() string

func (*PingTool) DisplayName added in v1.33.41

func (t *PingTool) DisplayName() string

func (*PingTool) Execute added in v1.33.41

func (t *PingTool) Execute(params map[string]interface{}) (interface{}, error)

func (*PingTool) InputSchema added in v1.33.41

func (t *PingTool) InputSchema() map[string]interface{}

func (*PingTool) Name added in v1.33.41

func (t *PingTool) Name() string

type RecallToolWrapper added in v1.55.0

type RecallToolWrapper struct{}

RecallToolWrapper implements the Tool interface for recall.

func (*RecallToolWrapper) Description added in v1.55.0

func (t *RecallToolWrapper) Description() string

func (*RecallToolWrapper) DisplayName added in v1.55.0

func (t *RecallToolWrapper) DisplayName() string

func (*RecallToolWrapper) Execute added in v1.55.0

func (t *RecallToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*RecallToolWrapper) InputSchema added in v1.55.0

func (t *RecallToolWrapper) InputSchema() map[string]interface{}

func (*RecallToolWrapper) Name added in v1.55.0

func (t *RecallToolWrapper) Name() string

type Registry

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

func GetGlobalRegistry

func GetGlobalRegistry() *Registry

Global functions for easy access

func NewRegistry

func NewRegistry() *Registry

func (*Registry) GetTool

func (r *Registry) GetTool(name string) (Tool, error)

func (*Registry) GetToolManifest

func (r *Registry) GetToolManifest() []ToolManifestEntry

GetToolManifest returns lightweight tool entries for on-demand loading

func (*Registry) GetToolsForNames

func (r *Registry) GetToolsForNames(names []string) []ToolDefinition

func (*Registry) ListToolNames

func (r *Registry) ListToolNames() []string

func (*Registry) ListTools

func (r *Registry) ListTools() []ToolDefinition

func (*Registry) RegisterTool

func (r *Registry) RegisterTool(tool Tool)

type SearchFilesToolWrapper

type SearchFilesToolWrapper struct{}

SearchFilesToolWrapper wraps the search files function

func (*SearchFilesToolWrapper) Description

func (t *SearchFilesToolWrapper) Description() string

func (*SearchFilesToolWrapper) DisplayName

func (t *SearchFilesToolWrapper) DisplayName() string

func (*SearchFilesToolWrapper) Execute

func (t *SearchFilesToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*SearchFilesToolWrapper) InputSchema

func (t *SearchFilesToolWrapper) InputSchema() map[string]interface{}

func (*SearchFilesToolWrapper) Name

func (t *SearchFilesToolWrapper) Name() string

type SendNotificationTool

type SendNotificationTool struct{}

func (*SendNotificationTool) Description

func (t *SendNotificationTool) Description() string

func (*SendNotificationTool) DisplayName

func (t *SendNotificationTool) DisplayName() string

func (*SendNotificationTool) Execute

func (t *SendNotificationTool) Execute(params map[string]interface{}) (interface{}, error)

func (*SendNotificationTool) InputSchema

func (t *SendNotificationTool) InputSchema() map[string]interface{}

func (*SendNotificationTool) Name

func (t *SendNotificationTool) Name() string

type StreamCallback

type StreamCallback func(event ToolStreamEvent)

StreamCallback is called for each streaming event during tool execution

type StreamingTool

type StreamingTool interface {
	Tool // Embed base interface

	// SupportsStreaming returns true if this tool can stream output
	SupportsStreaming() bool

	// ExecuteStreaming executes the tool and streams output via callback
	// The callback is called for each chunk of output
	// Final result is returned when complete
	ExecuteStreaming(params map[string]interface{}, callback StreamCallback) (interface{}, error)
}

StreamingTool extends Tool with streaming execution capability Tools that implement this interface can stream output during execution

type SubThreadResult added in v1.43.0

type SubThreadResult struct {
	ThreadID    string    `json:"thread_id"`
	TaskID      string    `json:"task_id"`
	Title       string    `json:"title"`
	Status      string    `json:"status"` // "completed" | "failed"
	Response    string    `json:"response,omitempty"`
	Error       string    `json:"error,omitempty"`
	Priority    int       `json:"priority"` // 0=normal, 1=high (for future interrupt support)
	CompletedAt time.Time `json:"completed_at"`
}

SubThreadResult represents a completed background task result

type SubThreadResultCollector added in v1.43.0

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

SubThreadResultCollector accumulates results from background tasks for a parent thread

func GetCollector added in v1.43.0

func GetCollector(parentThreadID string) *SubThreadResultCollector

GetCollector returns the collector for a parent thread, or nil if none exists

func GetOrCreateCollector added in v1.43.0

func GetOrCreateCollector(parentThreadID string) *SubThreadResultCollector

GetOrCreateCollector returns the collector for a parent thread, creating if needed

func (*SubThreadResultCollector) Add added in v1.43.0

Add appends a result to the collector (thread-safe)

func (*SubThreadResultCollector) Drain added in v1.43.0

Drain atomically returns all pending results and clears the buffer

func (*SubThreadResultCollector) Pending added in v1.43.0

func (c *SubThreadResultCollector) Pending() int

Pending returns the number of pending results without draining

type SubscribeToolWrapper

type SubscribeToolWrapper struct{}

SubscribeToolWrapper wraps the subscribe function

func (*SubscribeToolWrapper) Description

func (t *SubscribeToolWrapper) Description() string

func (*SubscribeToolWrapper) DisplayName

func (t *SubscribeToolWrapper) DisplayName() string

func (*SubscribeToolWrapper) Execute

func (t *SubscribeToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*SubscribeToolWrapper) InputSchema

func (t *SubscribeToolWrapper) InputSchema() map[string]interface{}

func (*SubscribeToolWrapper) Name

func (t *SubscribeToolWrapper) Name() string

type Subscription

type Subscription struct {
	ID           string    `json:"id"`
	Server       string    `json:"server"`
	Events       []string  `json:"events"`
	CredentialID *int64    `json:"credential_id,omitempty"`
	Prompt       *string   `json:"prompt,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

Subscription represents an MCP webhook subscription

type SubscriptionsListToolWrapper

type SubscriptionsListToolWrapper struct{}

SubscriptionsListToolWrapper wraps the subscriptions_list function

func (*SubscriptionsListToolWrapper) Description

func (t *SubscriptionsListToolWrapper) Description() string

func (*SubscriptionsListToolWrapper) DisplayName

func (t *SubscriptionsListToolWrapper) DisplayName() string

func (*SubscriptionsListToolWrapper) Execute

func (t *SubscriptionsListToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*SubscriptionsListToolWrapper) InputSchema

func (t *SubscriptionsListToolWrapper) InputSchema() map[string]interface{}

func (*SubscriptionsListToolWrapper) Name

type Task

type Task struct {
	ID          string     `json:"id"`
	ThreadID    *string    `json:"thread_id,omitempty"`
	Title       string     `json:"title"`
	Description *string    `json:"description,omitempty"`
	Type        string     `json:"type"`
	Status      string     `json:"status"`
	Priority    int        `json:"priority"`
	ExecuteAt   *time.Time `json:"execute_at,omitempty"`
	ExecutedAt  *time.Time `json:"executed_at,omitempty"`
	Recurrence  *string    `json:"recurrence,omitempty"`
	NextRun     *time.Time `json:"next_run,omitempty"`
	Result      *string    `json:"result,omitempty"`
	Source      string     `json:"source"`                 // 'local', 'delegated', or 'a2a'
	DelegatorID *string    `json:"delegator_id,omitempty"` // Agent ID that delegated this task
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`

	// A2A protocol fields
	ContextID  *string `json:"context_id,omitempty"`  // A2A contextId (conversation grouping)
	A2ATaskID  *string `json:"a2a_task_id,omitempty"` // External A2A task ID from caller
	Artifacts  *string `json:"artifacts,omitempty"`   // JSON array of A2A Artifacts
	History    *string `json:"history,omitempty"`     // JSON array of A2A Messages
	PushConfig *string `json:"push_config,omitempty"` // JSON push notification config
}

Task represents a task in the database

type Tool

type Tool interface {
	Name() string
	DisplayName() string // Human-readable name like "Create Task"
	Description() string
	InputSchema() map[string]interface{}
	Execute(params map[string]interface{}) (interface{}, error)
}

func GetTool

func GetTool(name string) (Tool, error)

type ToolDefinition

type ToolDefinition struct {
	Name        string                 `json:"name"`
	DisplayName string                 `json:"-"` // Internal use only - not sent to LLMs
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"input_schema"`
}

func GetToolsForNames

func GetToolsForNames(names []string) []ToolDefinition

func ListAllTools added in v1.33.41

func ListAllTools() []ToolDefinition

ListAllTools returns all registered tools with full details

func LoadToolsForMessage

func LoadToolsForMessage(userMessage string, allTools []ToolDefinition) []ToolDefinition

LoadToolsForMessage is a convenience function to load tools for a user message It reads the current config each time to pick up runtime changes

type ToolLoader

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

ToolLoader handles on-demand tool loading based on configured strategy

func GetToolLoader

func GetToolLoader() *ToolLoader

GetToolLoader returns the global tool loader

func NewToolLoader

func NewToolLoader(cfg *config.ToolLoadingConfig, registry *Registry) *ToolLoader

NewToolLoader creates a new tool loader with the given config

func NewToolLoaderWithTools

func NewToolLoaderWithTools(cfg *config.ToolLoadingConfig, allTools []ToolDefinition) *ToolLoader

NewToolLoaderWithTools creates a tool loader with BM25 index built from provided tools

func (*ToolLoader) GenerateManifestPrompt

func (l *ToolLoader) GenerateManifestPrompt(allTools []ToolDefinition) string

GenerateManifestPrompt creates a system prompt section listing available tools

func (*ToolLoader) GetToolManifest

func (l *ToolLoader) GetToolManifest(allTools []ToolDefinition) []ToolManifestEntry

GetToolManifest returns a lightweight list of all available tools

func (*ToolLoader) LoadTools

func (l *ToolLoader) LoadTools(userMessage string, allTools []ToolDefinition) []ToolDefinition

LoadTools returns tool definitions based on the configured strategy and user message If mode is "full" or not configured, returns all tools

type ToolManifestEntry

type ToolManifestEntry struct {
	Name    string `json:"name"`
	Summary string `json:"summary"`
}

ToolManifestEntry is a lightweight tool reference for on-demand loading

type ToolStreamEvent

type ToolStreamEvent struct {
	Type      string      `json:"type"`               // Event type (progress, output, log, chunk, error)
	Content   string      `json:"content,omitempty"`  // Text content
	Data      interface{} `json:"data,omitempty"`     // Structured data (optional)
	Progress  *float64    `json:"progress,omitempty"` // 0.0-1.0 for progress events
	Timestamp int64       `json:"timestamp"`          // Unix milliseconds
}

ToolStreamEvent represents a streaming event from a tool

func NewChunkEvent

func NewChunkEvent(content string) ToolStreamEvent

NewChunkEvent creates a chunk event for streaming content

func NewErrorEvent

func NewErrorEvent(content string) ToolStreamEvent

NewErrorEvent creates an error event (non-fatal)

func NewLogEvent

func NewLogEvent(content string) ToolStreamEvent

NewLogEvent creates a log event

func NewOutputEvent

func NewOutputEvent(content string) ToolStreamEvent

NewOutputEvent creates an output event

func NewProgressEvent

func NewProgressEvent(content string, progress float64) ToolStreamEvent

NewProgressEvent creates a progress event with percentage

func NewToolStreamEvent

func NewToolStreamEvent(eventType, content string) ToolStreamEvent

NewToolStreamEvent creates a new ToolStreamEvent with current timestamp

type UnsubscribeToolWrapper

type UnsubscribeToolWrapper struct{}

UnsubscribeToolWrapper wraps the unsubscribe function

func (*UnsubscribeToolWrapper) Description

func (t *UnsubscribeToolWrapper) Description() string

func (*UnsubscribeToolWrapper) DisplayName

func (t *UnsubscribeToolWrapper) DisplayName() string

func (*UnsubscribeToolWrapper) Execute

func (t *UnsubscribeToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*UnsubscribeToolWrapper) InputSchema

func (t *UnsubscribeToolWrapper) InputSchema() map[string]interface{}

func (*UnsubscribeToolWrapper) Name

func (t *UnsubscribeToolWrapper) Name() string

type UpdateSubscriptionToolWrapper

type UpdateSubscriptionToolWrapper struct{}

UpdateSubscriptionToolWrapper wraps the update_subscription function

func (*UpdateSubscriptionToolWrapper) Description

func (t *UpdateSubscriptionToolWrapper) Description() string

func (*UpdateSubscriptionToolWrapper) DisplayName

func (t *UpdateSubscriptionToolWrapper) DisplayName() string

func (*UpdateSubscriptionToolWrapper) Execute

func (t *UpdateSubscriptionToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*UpdateSubscriptionToolWrapper) InputSchema

func (t *UpdateSubscriptionToolWrapper) InputSchema() map[string]interface{}

func (*UpdateSubscriptionToolWrapper) Name

type UpdateTaskToolWrapper

type UpdateTaskToolWrapper struct{}

UpdateTaskToolWrapper wraps the update task function

func (*UpdateTaskToolWrapper) Description

func (t *UpdateTaskToolWrapper) Description() string

func (*UpdateTaskToolWrapper) DisplayName

func (t *UpdateTaskToolWrapper) DisplayName() string

func (*UpdateTaskToolWrapper) Execute

func (t *UpdateTaskToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*UpdateTaskToolWrapper) InputSchema

func (t *UpdateTaskToolWrapper) InputSchema() map[string]interface{}

func (*UpdateTaskToolWrapper) Name

func (t *UpdateTaskToolWrapper) Name() string

type WaitToolWrapper

type WaitToolWrapper struct{}

WaitToolWrapper implements a general-purpose wait/sleep tool

func (*WaitToolWrapper) Description

func (t *WaitToolWrapper) Description() string

func (*WaitToolWrapper) DisplayName

func (t *WaitToolWrapper) DisplayName() string

func (*WaitToolWrapper) Execute

func (t *WaitToolWrapper) Execute(params map[string]interface{}) (interface{}, error)

func (*WaitToolWrapper) InputSchema

func (t *WaitToolWrapper) InputSchema() map[string]interface{}

func (*WaitToolWrapper) Name

func (t *WaitToolWrapper) Name() string

Directories

Path Synopsis
Simple test MCP server using Streamable HTTP transport Deploy this to test the external MCP client implementation
Simple test MCP server using Streamable HTTP transport Deploy this to test the external MCP client implementation

Jump to

Keyboard shortcuts

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