tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 58 Imported by: 0

Documentation

Overview

Package tools registers workspace, shell, MCP, and agent tool implementations.

Package tools defines the model-callable workspace tools and their execution registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalToolName

func CanonicalToolName(name string) string

CanonicalToolName normalizes a model-supplied tool name or known alias into the canonical registry name used for permission and execution checks.

func ClaudeToolAliases

func ClaudeToolAliases() map[string]string

ClaudeToolAliases returns the Claude-style display aliases accepted by the tool registry, keyed by alias and mapped to Codog's canonical tool names.

func ContextWithSessionID

func ContextWithSessionID(ctx context.Context, sessionID string) context.Context

func NewMCPToolName

func NewMCPToolName(serverName, toolName string) string

NewMCPToolName returns the canonical registry name for a tool exposed by an MCP server.

func SessionIDFromContext

func SessionIDFromContext(ctx context.Context) string

func SuggestedPermissionRule

func SuggestedPermissionRule(name string, input string) string

SuggestedPermissionRule returns a session-scoped allow rule narrowed to the current invocation when its input exposes a stable command, path, or query.

func ToolAllowedInPlanMode

func ToolAllowedInPlanMode(name string, permission Permission) bool

ToolAllowedInPlanMode reports whether a tool may execute while plan mode is active.

func ToolVisibleInPlanMode

func ToolVisibleInPlanMode(name string, permission Permission) bool

ToolVisibleInPlanMode reports whether a tool should be advertised while plan mode is active.

Types

type AgentTool

type AgentTool struct {
	Workspace   string
	ConfigHome  string
	ConfigEnv   map[string]string
	Executable  string
	Definitions []agentdefs.Definition
	PluginDirs  []string
}

func (AgentTool) Definition

func (AgentTool) Definition() anthropic.ToolDefinition

func (AgentTool) Execute

func (t AgentTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (AgentTool) Permission

func (AgentTool) Permission() Permission

type ApplyPatchTool

type ApplyPatchTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (ApplyPatchTool) Definition

func (ApplyPatchTool) Execute

func (t ApplyPatchTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (ApplyPatchTool) Permission

func (ApplyPatchTool) Permission() Permission

type ApprovalTokenTool

type ApprovalTokenTool struct {
	ConfigHome string
}

func (ApprovalTokenTool) Definition

func (ApprovalTokenTool) Execute

func (t ApprovalTokenTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (ApprovalTokenTool) Permission

func (ApprovalTokenTool) Permission() Permission

type AskUserQuestionTool

type AskUserQuestionTool struct {
	In        io.Reader
	Out       io.Writer
	OnRequest func(UserQuestionRequest)
}

func (AskUserQuestionTool) Definition

func (AskUserQuestionTool) Execute

func (t AskUserQuestionTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (AskUserQuestionTool) Permission

func (AskUserQuestionTool) Permission() Permission

type BashOutputTool

type BashOutputTool struct {
	Workspace  string
	ConfigHome string
}

func (BashOutputTool) Definition

func (BashOutputTool) Execute

func (t BashOutputTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (BashOutputTool) Permission

func (BashOutputTool) Permission() Permission

type BashTool

type BashTool struct {
	Workspace       string
	ConfigHome      string
	ConfigEnv       map[string]string
	DefaultShell    string
	PowerShell      string
	SandboxStrategy string
	Sandbox         config.SandboxConfig
}

func (BashTool) Definition

func (BashTool) Definition() anthropic.ToolDefinition

func (BashTool) Execute

func (t BashTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (BashTool) Permission

func (BashTool) Permission() Permission

type BranchFreshnessTool

type BranchFreshnessTool struct {
	Workspace string
}

func (BranchFreshnessTool) Definition

func (BranchFreshnessTool) Execute

func (BranchFreshnessTool) Permission

func (BranchFreshnessTool) Permission() Permission

type BriefTool

type BriefTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (BriefTool) Definition

func (BriefTool) Definition() anthropic.ToolDefinition

func (BriefTool) Execute

func (t BriefTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (BriefTool) Permission

func (BriefTool) Permission() Permission

type CommandTool

type CommandTool struct {
	Name        string
	Description string
	Schema      map[string]any
	Required    Permission
	Command     string
	Args        []string
	Workspace   string
	ConfigEnv   map[string]string
}

CommandTool adapts a local executable into a model-callable tool. Tools without an explicit permission default to danger-full-access because they run arbitrary host executables.

func (CommandTool) Definition

func (t CommandTool) Definition() anthropic.ToolDefinition

func (CommandTool) Execute

func (t CommandTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (CommandTool) Permission

func (t CommandTool) Permission() Permission

type ConfigTool

type ConfigTool struct {
	Workspace  string
	ConfigHome string
}

func (ConfigTool) Definition

func (ConfigTool) Definition() anthropic.ToolDefinition

func (ConfigTool) Execute

func (t ConfigTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (ConfigTool) Permission

func (ConfigTool) Permission() Permission

type CronCreateTool

type CronCreateTool struct {
	ConfigHome string
}

func (CronCreateTool) Definition

func (CronCreateTool) Execute

func (t CronCreateTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (CronCreateTool) Permission

func (CronCreateTool) Permission() Permission

type CronDeleteTool

type CronDeleteTool struct {
	ConfigHome string
}

func (CronDeleteTool) Definition

func (CronDeleteTool) Execute

func (t CronDeleteTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (CronDeleteTool) Permission

func (CronDeleteTool) Permission() Permission

type CronListTool

type CronListTool struct {
	ConfigHome string
}

func (CronListTool) Definition

func (CronListTool) Definition() anthropic.ToolDefinition

func (CronListTool) Execute

func (t CronListTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (CronListTool) Permission

func (CronListTool) Permission() Permission

type EditFileTool

type EditFileTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (EditFileTool) Definition

func (EditFileTool) Definition() anthropic.ToolDefinition

func (EditFileTool) Execute

func (t EditFileTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (EditFileTool) Permission

func (EditFileTool) Permission() Permission

type EnterPlanModeTool

type EnterPlanModeTool struct {
	Workspace string
}

func (EnterPlanModeTool) Definition

func (EnterPlanModeTool) Execute

func (t EnterPlanModeTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (EnterPlanModeTool) Permission

func (EnterPlanModeTool) Permission() Permission

type EnterWorktreeTool

type EnterWorktreeTool struct {
	Workspace string
}

func (EnterWorktreeTool) Definition

func (EnterWorktreeTool) Execute

func (t EnterWorktreeTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (EnterWorktreeTool) Permission

func (EnterWorktreeTool) Permission() Permission

type ExitPlanModeTool

type ExitPlanModeTool struct {
	Workspace string
}

func (ExitPlanModeTool) Definition

func (ExitPlanModeTool) Execute

func (t ExitPlanModeTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (ExitPlanModeTool) Permission

func (ExitPlanModeTool) Permission() Permission

type ExitWorktreeTool

type ExitWorktreeTool struct {
	Workspace string
}

func (ExitWorktreeTool) Definition

func (ExitWorktreeTool) Execute

func (t ExitWorktreeTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (ExitWorktreeTool) Permission

func (ExitWorktreeTool) Permission() Permission

type GetMCPPromptTool

type GetMCPPromptTool struct {
	Servers map[string]config.MCPServerConfig
}

GetMCPPromptTool renders one prompt exposed by a configured MCP server.

func (GetMCPPromptTool) Definition

func (t GetMCPPromptTool) Definition() anthropic.ToolDefinition

func (GetMCPPromptTool) Execute

func (t GetMCPPromptTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (GetMCPPromptTool) Permission

func (GetMCPPromptTool) Permission() Permission

type GitBlameTool

type GitBlameTool struct {
	Workspace string
}

func (GitBlameTool) Definition

func (GitBlameTool) Definition() anthropic.ToolDefinition

func (GitBlameTool) Execute

func (t GitBlameTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (GitBlameTool) Permission

func (GitBlameTool) Permission() Permission

type GitDiffTool

type GitDiffTool struct {
	Workspace string
}

func (GitDiffTool) Definition

func (GitDiffTool) Definition() anthropic.ToolDefinition

func (GitDiffTool) Execute

func (t GitDiffTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (GitDiffTool) Permission

func (GitDiffTool) Permission() Permission

type GitLogTool

type GitLogTool struct {
	Workspace string
}

func (GitLogTool) Definition

func (GitLogTool) Definition() anthropic.ToolDefinition

func (GitLogTool) Execute

func (t GitLogTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (GitLogTool) Permission

func (GitLogTool) Permission() Permission

type GitShowTool

type GitShowTool struct {
	Workspace string
}

func (GitShowTool) Definition

func (GitShowTool) Definition() anthropic.ToolDefinition

func (GitShowTool) Execute

func (t GitShowTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (GitShowTool) Permission

func (GitShowTool) Permission() Permission

type GitStatusTool

type GitStatusTool struct {
	Workspace string
}

func (GitStatusTool) Definition

func (GitStatusTool) Definition() anthropic.ToolDefinition

func (GitStatusTool) Execute

func (t GitStatusTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (GitStatusTool) Permission

func (GitStatusTool) Permission() Permission

type GlobTool

type GlobTool struct {
	Workspace        string
	AdditionalDirs   []string
	RespectGitignore bool
}

func (GlobTool) Definition

func (GlobTool) Definition() anthropic.ToolDefinition

func (GlobTool) Execute

func (t GlobTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (GlobTool) Permission

func (GlobTool) Permission() Permission

type GrepTool

type GrepTool struct {
	Workspace        string
	AdditionalDirs   []string
	RespectGitignore bool
}

func (GrepTool) Definition

func (GrepTool) Definition() anthropic.ToolDefinition

func (GrepTool) Execute

func (t GrepTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (GrepTool) Permission

func (GrepTool) Permission() Permission

type KillBashTool

type KillBashTool struct {
	Workspace  string
	ConfigHome string
}

func (KillBashTool) Definition

func (KillBashTool) Definition() anthropic.ToolDefinition

func (KillBashTool) Execute

func (t KillBashTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (KillBashTool) Permission

func (KillBashTool) Permission() Permission

type LSPTool

type LSPTool struct {
	Workspace      string
	AdditionalDirs []string
	ConfigHome     string
}

func (LSPTool) Definition

func (LSPTool) Definition() anthropic.ToolDefinition

func (LSPTool) Execute

func (t LSPTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (LSPTool) Permission

func (LSPTool) Permission() Permission

type LSTool

type LSTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (LSTool) Definition

func (LSTool) Definition() anthropic.ToolDefinition

func (LSTool) Execute

func (t LSTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (LSTool) Permission

func (LSTool) Permission() Permission

type ListMCPPromptsTool

type ListMCPPromptsTool struct {
	Servers map[string]config.MCPServerConfig
}

ListMCPPromptsTool lists prompts exposed by configured MCP servers.

func (ListMCPPromptsTool) Definition

func (ListMCPPromptsTool) Execute

func (t ListMCPPromptsTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (ListMCPPromptsTool) Permission

func (ListMCPPromptsTool) Permission() Permission

type ListMCPResourceTemplatesTool

type ListMCPResourceTemplatesTool struct {
	Servers map[string]config.MCPServerConfig
}

ListMCPResourceTemplatesTool lists resource templates exposed by configured MCP servers.

func (ListMCPResourceTemplatesTool) Definition

func (ListMCPResourceTemplatesTool) Execute

func (ListMCPResourceTemplatesTool) Permission

type ListMCPResourcesTool

type ListMCPResourcesTool struct {
	Servers map[string]config.MCPServerConfig
}

ListMCPResourcesTool lists resources exposed by configured MCP servers.

func (ListMCPResourcesTool) Definition

func (ListMCPResourcesTool) Execute

func (t ListMCPResourcesTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (ListMCPResourcesTool) Permission

func (ListMCPResourcesTool) Permission() Permission

type MCPAuthTool

type MCPAuthTool struct {
	Servers      map[string]config.MCPServerConfig
	ConfigHome   string
	OAuthProfile string
}

MCPAuthTool reports, refreshes, or clears authentication readiness for a configured MCP server.

func (MCPAuthTool) Definition

func (MCPAuthTool) Definition() anthropic.ToolDefinition

func (MCPAuthTool) Execute

func (t MCPAuthTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (MCPAuthTool) Permission

func (MCPAuthTool) Permission() Permission

type MCPDispatchTool

type MCPDispatchTool struct {
	Servers map[string]config.MCPServerConfig
}

MCPDispatchTool calls a named tool on one configured MCP server.

func (MCPDispatchTool) Definition

func (MCPDispatchTool) Execute

func (t MCPDispatchTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (MCPDispatchTool) Permission

func (MCPDispatchTool) Permission() Permission

type MCPTool

type MCPTool struct {
	Name        string
	Description string
	Schema      map[string]any
	Required    Permission
	ServerName  string
	Server      config.MCPServerConfig
	RemoteName  string
}

MCPTool adapts a remote MCP tool into Codog's local tool contract.

func (MCPTool) Definition

func (t MCPTool) Definition() anthropic.ToolDefinition

func (MCPTool) Execute

func (t MCPTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (MCPTool) Permission

func (t MCPTool) Permission() Permission

type MultiEditTool

type MultiEditTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (MultiEditTool) Definition

func (MultiEditTool) Definition() anthropic.ToolDefinition

func (MultiEditTool) Execute

func (t MultiEditTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (MultiEditTool) Permission

func (MultiEditTool) Permission() Permission

type NotebookEditTool

type NotebookEditTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (NotebookEditTool) Definition

func (NotebookEditTool) Execute

func (t NotebookEditTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (NotebookEditTool) Permission

func (NotebookEditTool) Permission() Permission

type NotebookReadTool

type NotebookReadTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (NotebookReadTool) Definition

func (NotebookReadTool) Execute

func (t NotebookReadTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (NotebookReadTool) Permission

func (NotebookReadTool) Permission() Permission

type NudgeTool

type NudgeTool struct {
	ConfigHome string
}

func (NudgeTool) Definition

func (NudgeTool) Definition() anthropic.ToolDefinition

func (NudgeTool) Execute

func (t NudgeTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (NudgeTool) Permission

func (NudgeTool) Permission() Permission

type Permission

type Permission string

Permission is the minimum host access level required to run a tool.

const (
	// PermissionReadOnly allows inspection-only tools.
	PermissionReadOnly Permission = "read-only"
	// PermissionWorkspace allows writes inside the configured workspace.
	PermissionWorkspace Permission = "workspace-write"
	// PermissionDanger allows unrestricted host actions.
	PermissionDanger Permission = "danger-full-access"
	// PermissionPrompt requires a user approval decision before execution.
	PermissionPrompt Permission = "prompt"
	// PermissionAllow marks tools that are explicitly allow-listed.
	PermissionAllow Permission = "allow"
)

type PermissionCheckTool

type PermissionCheckTool struct{}

func (PermissionCheckTool) Definition

func (PermissionCheckTool) Execute

func (PermissionCheckTool) Permission

func (PermissionCheckTool) Permission() Permission

type PermissionDecision

type PermissionDecision struct {
	ToolName    string
	Required    Permission
	Mode        Permission
	Input       string
	Allowed     bool
	WouldPrompt bool
	Reason      string
	Message     string
	Feedback    string
	Rule        string
}

PermissionDecision captures the resolved permission outcome for one proposed tool invocation.

type PermissionResponse

type PermissionResponse struct {
	Decision string `json:"decision"`
	Feedback string `json:"feedback,omitempty"`
	Rule     string `json:"rule,omitempty"`
}

PermissionResponse is an interactive answer to a permission request. Decision accepts allow_once, allow_always, or deny. Feedback is passed back to the model, and Rule narrows an allow_always answer to the current tool.

type PolicyEvaluateTool

type PolicyEvaluateTool struct{}

func (PolicyEvaluateTool) Definition

func (PolicyEvaluateTool) Execute

func (PolicyEvaluateTool) Permission

func (PolicyEvaluateTool) Permission() Permission

type PowerShellTool

type PowerShellTool struct {
	Workspace  string
	ConfigHome string
	ConfigEnv  map[string]string
	Executable string
}

func (PowerShellTool) Definition

func (PowerShellTool) Execute

func (t PowerShellTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (PowerShellTool) Permission

func (PowerShellTool) Permission() Permission

type Prompter

type Prompter struct {
	Mode           Permission
	AllowRules     []string
	DenyRules      []string
	AskRules       []string
	DeniedTools    []string
	Workspace      string
	AdditionalDirs []string
	DefaultShell   string
	In             io.Reader
	Err            io.Writer
	OnRequest      func(PermissionDecision)
	OnDecision     func(PermissionDecision)
}

Prompter decides whether a tool invocation may run under the active permission mode and records the decision for callers that need audit data.

func ReadOnlyPrompter

func ReadOnlyPrompter(base *Prompter, workspace string) *Prompter

ReadOnlyPrompter derives a prompter that only allows read-only tools.

func (*Prompter) Authorize

func (p *Prompter) Authorize(name string, required Permission, input json.RawMessage) error

func (*Prompter) AuthorizeDecision

func (p *Prompter) AuthorizeDecision(name string, required Permission, input json.RawMessage) (PermissionDecision, error)

AuthorizeDecision authorizes one invocation and returns the resolved decision so callers can preserve user feedback in the model-visible result.

func (*Prompter) Decide

func (p *Prompter) Decide(name string, required Permission, input json.RawMessage) PermissionDecision

type ProvisionalStatusTool

type ProvisionalStatusTool struct {
	ConfigHome string
}

func (ProvisionalStatusTool) Definition

func (ProvisionalStatusTool) Execute

func (ProvisionalStatusTool) Permission

func (ProvisionalStatusTool) Permission() Permission

type REPLTool

type REPLTool struct {
	Workspace string
	ConfigEnv map[string]string
}

func (REPLTool) Definition

func (REPLTool) Definition() anthropic.ToolDefinition

func (REPLTool) Execute

func (t REPLTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (REPLTool) Permission

func (REPLTool) Permission() Permission

type ReadFileTool

type ReadFileTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (ReadFileTool) Definition

func (ReadFileTool) Definition() anthropic.ToolDefinition

func (ReadFileTool) Execute

func (t ReadFileTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (ReadFileTool) Permission

func (ReadFileTool) Permission() Permission

type ReadMCPResourceTool

type ReadMCPResourceTool struct {
	Servers map[string]config.MCPServerConfig
}

ReadMCPResourceTool reads one resource URI from a configured MCP server.

func (ReadMCPResourceTool) Definition

func (ReadMCPResourceTool) Execute

func (t ReadMCPResourceTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (ReadMCPResourceTool) Permission

func (ReadMCPResourceTool) Permission() Permission

type RecoveryAttemptTool

type RecoveryAttemptTool struct {
	ConfigHome string
}

func (RecoveryAttemptTool) Definition

func (RecoveryAttemptTool) Execute

func (RecoveryAttemptTool) Permission

func (RecoveryAttemptTool) Permission() Permission

type RecoveryRecipeTool

type RecoveryRecipeTool struct {
	ConfigHome string
}

func (RecoveryRecipeTool) Definition

func (RecoveryRecipeTool) Execute

func (RecoveryRecipeTool) Permission

func (RecoveryRecipeTool) Permission() Permission

type RecoveryStatusTool

type RecoveryStatusTool struct {
	ConfigHome string
}

func (RecoveryStatusTool) Definition

func (RecoveryStatusTool) Execute

func (t RecoveryStatusTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (RecoveryStatusTool) Permission

func (RecoveryStatusTool) Permission() Permission

type Registry

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

Registry holds all tools available for a model turn.

func NewRegistry

func NewRegistry(workspace string) *Registry

NewRegistry constructs the default tool registry for a workspace.

func NewRegistryWithOptions

func NewRegistryWithOptions(workspace string, opts RegistryOptions) *Registry

NewRegistryWithOptions constructs the default tool registry and wires optional integrations such as MCP servers, sandbox defaults, config state, and plugin execution settings.

func (*Registry) DeferredInfos

func (r *Registry) DeferredInfos() []ToolInfo

DeferredInfos returns searchable model tools whose schemas are not present in the initial request.

func (*Registry) Definitions

func (r *Registry) Definitions() []anthropic.ToolDefinition

Definitions returns sorted model-facing definitions for every registered tool.

func (*Registry) DefinitionsForModel

func (r *Registry) DefinitionsForModel(loaded []string) []anthropic.ToolDefinition

DefinitionsForModel returns the eager tool surface plus deferred tools that tool_search loaded during the current model turn.

func (*Registry) DefinitionsForPlanMode

func (r *Registry) DefinitionsForPlanMode() []anthropic.ToolDefinition

DefinitionsForPlanMode returns the subset of tool definitions visible while the model is planning rather than executing workspace changes.

func (*Registry) DefinitionsForPlanModeWithLoaded

func (r *Registry) DefinitionsForPlanModeWithLoaded(loaded []string) []anthropic.ToolDefinition

DefinitionsForPlanModeWithLoaded applies model deferral and plan-mode access rules to the advertised tool surface.

func (*Registry) Execute

func (r *Registry) Execute(ctx context.Context, name string, input json.RawMessage, prompter *Prompter) (string, error)

func (*Registry) Has

func (r *Registry) Has(name string) bool

Has reports whether a tool name or supported alias resolves to a registered tool.

func (*Registry) Info

func (r *Registry) Info(name string) (ToolInfo, bool)

func (*Registry) Infos

func (r *Registry) Infos() []ToolInfo

func (*Registry) Register

func (r *Registry) Register(tool Tool)

Register adds or replaces a tool by the name declared in its definition.

func (*Registry) UpdateBuiltinScope

func (r *Registry) UpdateBuiltinScope(workspace string, opts RegistryOptions)

UpdateBuiltinScope re-registers built-in tools with a new workspace or execution configuration while preserving the registry object.

type RegistryOptions

type RegistryOptions struct {
	SandboxStrategy  string
	Sandbox          config.SandboxConfig
	AdditionalDirs   []string
	ConfigHome       string
	ConfigEnv        map[string]string
	Executable       string
	DefaultShell     string
	TrustedRoots     []string
	RespectGitignore bool
	OAuthProfile     string
	MCPServers       map[string]config.MCPServerConfig
	PowerShell       string
	RAGBaseURL       string
	RAGTimeout       time.Duration
	RAGTopKMax       int
	QuestionIn       io.Reader
	QuestionOut      io.Writer
	AgentDefinitions []agentdefs.Definition
	PluginDirs       []string
}

RegistryOptions controls optional tool integrations and execution defaults.

type RemoteTriggerTool

type RemoteTriggerTool struct{}

func (RemoteTriggerTool) Definition

func (RemoteTriggerTool) Execute

func (RemoteTriggerTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (RemoteTriggerTool) Permission

func (RemoteTriggerTool) Permission() Permission

type ReportBackpressureTool

type ReportBackpressureTool struct {
	ConfigHome string
}

func (ReportBackpressureTool) Definition

func (ReportBackpressureTool) Execute

func (ReportBackpressureTool) Permission

func (ReportBackpressureTool) Permission() Permission

type ReportSchemaTool

type ReportSchemaTool struct{}

func (ReportSchemaTool) Definition

func (ReportSchemaTool) Execute

func (ReportSchemaTool) Permission

func (ReportSchemaTool) Permission() Permission

type RetrieveContextTool

type RetrieveContextTool struct {
	BaseURL string
	Timeout time.Duration
	TopKMax int
}

RetrieveContextTool queries an external workspace RAG service.

func (RetrieveContextTool) Definition

func (RetrieveContextTool) Execute

func (t RetrieveContextTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (RetrieveContextTool) Permission

func (RetrieveContextTool) Permission() Permission

type RoadmapPinpointTool

type RoadmapPinpointTool struct {
	ConfigHome string
}

func (RoadmapPinpointTool) Definition

func (RoadmapPinpointTool) Execute

func (RoadmapPinpointTool) Permission

func (RoadmapPinpointTool) Permission() Permission

type RunTaskPacketTool

type RunTaskPacketTool struct {
	Workspace  string
	ConfigHome string
	ConfigEnv  map[string]string
	Executable string
}

func (RunTaskPacketTool) Definition

func (RunTaskPacketTool) Execute

func (t RunTaskPacketTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (RunTaskPacketTool) Permission

func (RunTaskPacketTool) Permission() Permission

type SendUserMessageTool

type SendUserMessageTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (SendUserMessageTool) Definition

func (SendUserMessageTool) Execute

func (t SendUserMessageTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (SendUserMessageTool) Permission

func (SendUserMessageTool) Permission() Permission

type SkillTool

type SkillTool struct {
	Workspace  string
	ConfigHome string
}

func (SkillTool) Definition

func (SkillTool) Definition() anthropic.ToolDefinition

func (SkillTool) Execute

func (t SkillTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (SkillTool) Permission

func (SkillTool) Permission() Permission

type SleepTool

type SleepTool struct{}

func (SleepTool) Definition

func (SleepTool) Definition() anthropic.ToolDefinition

func (SleepTool) Execute

func (SleepTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (SleepTool) Permission

func (SleepTool) Permission() Permission

type StructuredOutputTool

type StructuredOutputTool struct{}

func (StructuredOutputTool) Definition

func (StructuredOutputTool) Execute

func (StructuredOutputTool) Permission

func (StructuredOutputTool) Permission() Permission

type TaskCreateTool

type TaskCreateTool struct {
	Workspace  string
	ConfigHome string
	ConfigEnv  map[string]string
	Executable string
}

func (TaskCreateTool) Definition

func (TaskCreateTool) Execute

func (t TaskCreateTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (TaskCreateTool) Permission

func (TaskCreateTool) Permission() Permission

type TaskGetTool

type TaskGetTool struct {
	Workspace  string
	ConfigHome string
}

func (TaskGetTool) Definition

func (TaskGetTool) Definition() anthropic.ToolDefinition

func (TaskGetTool) Execute

func (t TaskGetTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TaskGetTool) Permission

func (TaskGetTool) Permission() Permission

type TaskHeartbeatTool

type TaskHeartbeatTool struct {
	Workspace  string
	ConfigHome string
}

func (TaskHeartbeatTool) Definition

func (TaskHeartbeatTool) Execute

func (t TaskHeartbeatTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TaskHeartbeatTool) Permission

func (TaskHeartbeatTool) Permission() Permission

type TaskLaneBoardTool

type TaskLaneBoardTool struct {
	Workspace  string
	ConfigHome string
}

func (TaskLaneBoardTool) Definition

func (TaskLaneBoardTool) Execute

func (t TaskLaneBoardTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TaskLaneBoardTool) Permission

func (TaskLaneBoardTool) Permission() Permission

type TaskListTool

type TaskListTool struct {
	Workspace  string
	ConfigHome string
}

func (TaskListTool) Definition

func (TaskListTool) Definition() anthropic.ToolDefinition

func (TaskListTool) Execute

func (t TaskListTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TaskListTool) Permission

func (TaskListTool) Permission() Permission

type TaskOutputTool

type TaskOutputTool struct {
	Workspace  string
	ConfigHome string
}

func (TaskOutputTool) Definition

func (TaskOutputTool) Execute

func (t TaskOutputTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TaskOutputTool) Permission

func (TaskOutputTool) Permission() Permission

type TaskStatusTool

type TaskStatusTool struct {
	Workspace  string
	ConfigHome string
}

func (TaskStatusTool) Definition

func (TaskStatusTool) Execute

func (t TaskStatusTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TaskStatusTool) Permission

func (TaskStatusTool) Permission() Permission

type TaskStopTool

type TaskStopTool struct {
	Workspace  string
	ConfigHome string
}

func (TaskStopTool) Definition

func (TaskStopTool) Definition() anthropic.ToolDefinition

func (TaskStopTool) Execute

func (t TaskStopTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TaskStopTool) Permission

func (TaskStopTool) Permission() Permission

type TaskSuperviseTool

type TaskSuperviseTool struct {
	Workspace  string
	ConfigHome string
}

func (TaskSuperviseTool) Definition

func (TaskSuperviseTool) Execute

func (t TaskSuperviseTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TaskSuperviseTool) Permission

func (TaskSuperviseTool) Permission() Permission

type TaskUpdateTool

type TaskUpdateTool struct {
	Workspace  string
	ConfigHome string
}

func (TaskUpdateTool) Definition

func (TaskUpdateTool) Execute

func (t TaskUpdateTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TaskUpdateTool) Permission

func (TaskUpdateTool) Permission() Permission

type TeamCreateTool

type TeamCreateTool struct {
	Workspace  string
	ConfigHome string
	ConfigEnv  map[string]string
	Executable string
}

func (TeamCreateTool) Definition

func (TeamCreateTool) Execute

func (t TeamCreateTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (TeamCreateTool) Permission

func (TeamCreateTool) Permission() Permission

type TeamDeleteTool

type TeamDeleteTool struct {
	ConfigHome string
}

func (TeamDeleteTool) Definition

func (TeamDeleteTool) Execute

func (t TeamDeleteTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TeamDeleteTool) Permission

func (TeamDeleteTool) Permission() Permission

type TeamGetTool

type TeamGetTool struct {
	Workspace  string
	ConfigHome string
}

func (TeamGetTool) Definition

func (TeamGetTool) Definition() anthropic.ToolDefinition

func (TeamGetTool) Execute

func (t TeamGetTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TeamGetTool) Permission

func (TeamGetTool) Permission() Permission

type TeamListTool

type TeamListTool struct {
	Workspace  string
	ConfigHome string
}

func (TeamListTool) Definition

func (TeamListTool) Definition() anthropic.ToolDefinition

func (TeamListTool) Execute

func (t TeamListTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TeamListTool) Permission

func (TeamListTool) Permission() Permission

type TestingPermissionTool

type TestingPermissionTool = PermissionCheckTool

TestingPermissionTool is a compatibility alias for older transcripts and archived Claude-style tool names.

type TodoReadTool

type TodoReadTool struct {
	Workspace string
}

func (TodoReadTool) Definition

func (TodoReadTool) Definition() anthropic.ToolDefinition

func (TodoReadTool) Execute

func (t TodoReadTool) Execute(_ context.Context, _ json.RawMessage) (string, error)

func (TodoReadTool) Permission

func (TodoReadTool) Permission() Permission

type TodoWriteTool

type TodoWriteTool struct {
	Workspace string
}

func (TodoWriteTool) Definition

func (TodoWriteTool) Definition() anthropic.ToolDefinition

func (TodoWriteTool) Execute

func (t TodoWriteTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (TodoWriteTool) Permission

func (TodoWriteTool) Permission() Permission

type Tool

type Tool interface {
	Definition() anthropic.ToolDefinition
	Permission() Permission
	Execute(context.Context, json.RawMessage) (string, error)
}

Tool is the runtime contract implemented by every model-callable tool.

type ToolInfo

type ToolInfo struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Permission  Permission     `json:"permission"`
	InputSchema map[string]any `json:"input_schema"`
}

ToolInfo is the JSON-safe metadata view of one registered tool.

type ToolSearchTool

type ToolSearchTool struct {
	Registry *Registry
}

func (ToolSearchTool) Definition

func (ToolSearchTool) Execute

func (t ToolSearchTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (ToolSearchTool) Permission

func (ToolSearchTool) Permission() Permission

type UserQuestion

type UserQuestion struct {
	Question    string               `json:"question"`
	Header      string               `json:"header"`
	Options     []UserQuestionOption `json:"options"`
	MultiSelect bool                 `json:"multiSelect"`
}

UserQuestion is one question in the Claude-compatible multi-question request shape.

type UserQuestionOption

type UserQuestionOption struct {
	Label       string `json:"label"`
	Description string `json:"description"`
	Preview     string `json:"preview,omitempty"`
}

UserQuestionOption is one labeled answer with optional supporting preview.

type UserQuestionRequest

type UserQuestionRequest struct {
	Question  string
	Choices   []string
	Default   string
	Questions []UserQuestion
}

UserQuestionRequest is the normalized question presented by AskUserQuestionTool before it waits for an answer.

type WebFetchTool

type WebFetchTool struct{}

func (WebFetchTool) Definition

func (WebFetchTool) Definition() anthropic.ToolDefinition

func (WebFetchTool) Execute

func (WebFetchTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (WebFetchTool) Permission

func (WebFetchTool) Permission() Permission

type WebSearchTool

type WebSearchTool struct{}

func (WebSearchTool) Definition

func (WebSearchTool) Definition() anthropic.ToolDefinition

func (WebSearchTool) Execute

func (WebSearchTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (WebSearchTool) Permission

func (WebSearchTool) Permission() Permission

type WorkerAwaitReadyTool

type WorkerAwaitReadyTool struct {
	Workspace  string
	ConfigHome string
}

func (WorkerAwaitReadyTool) Definition

func (WorkerAwaitReadyTool) Execute

func (WorkerAwaitReadyTool) Permission

func (WorkerAwaitReadyTool) Permission() Permission

type WorkerCreateTool

type WorkerCreateTool struct {
	Workspace    string
	ConfigHome   string
	TrustedRoots []string
}

func (WorkerCreateTool) Definition

func (WorkerCreateTool) Execute

func (t WorkerCreateTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (WorkerCreateTool) Permission

func (WorkerCreateTool) Permission() Permission

type WorkerGetTool

type WorkerGetTool struct {
	Workspace  string
	ConfigHome string
}

func (WorkerGetTool) Definition

func (WorkerGetTool) Definition() anthropic.ToolDefinition

func (WorkerGetTool) Execute

func (t WorkerGetTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (WorkerGetTool) Permission

func (WorkerGetTool) Permission() Permission

type WorkerListTool

type WorkerListTool struct {
	Workspace  string
	ConfigHome string
}

func (WorkerListTool) Definition

func (WorkerListTool) Execute

func (t WorkerListTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (WorkerListTool) Permission

func (WorkerListTool) Permission() Permission

type WorkerObserveCompletionTool

type WorkerObserveCompletionTool struct {
	Workspace  string
	ConfigHome string
}

func (WorkerObserveCompletionTool) Definition

func (WorkerObserveCompletionTool) Execute

func (WorkerObserveCompletionTool) Permission

type WorkerObserveTool

type WorkerObserveTool struct {
	Workspace  string
	ConfigHome string
}

func (WorkerObserveTool) Definition

func (WorkerObserveTool) Execute

func (t WorkerObserveTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (WorkerObserveTool) Permission

func (WorkerObserveTool) Permission() Permission

type WorkerResolveTrustTool

type WorkerResolveTrustTool struct {
	Workspace  string
	ConfigHome string
}

func (WorkerResolveTrustTool) Definition

func (WorkerResolveTrustTool) Execute

func (WorkerResolveTrustTool) Permission

func (WorkerResolveTrustTool) Permission() Permission

type WorkerRestartTool

type WorkerRestartTool struct {
	Workspace  string
	ConfigHome string
}

func (WorkerRestartTool) Definition

func (WorkerRestartTool) Execute

func (t WorkerRestartTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (WorkerRestartTool) Permission

func (WorkerRestartTool) Permission() Permission

type WorkerSendPromptTool

type WorkerSendPromptTool struct {
	Workspace  string
	ConfigHome string
	ConfigEnv  map[string]string
	Executable string
}

func (WorkerSendPromptTool) Definition

func (WorkerSendPromptTool) Execute

func (t WorkerSendPromptTool) Execute(ctx context.Context, input json.RawMessage) (string, error)

func (WorkerSendPromptTool) Permission

func (WorkerSendPromptTool) Permission() Permission

type WorkerStartupTimeoutTool

type WorkerStartupTimeoutTool struct {
	Workspace  string
	ConfigHome string
}

func (WorkerStartupTimeoutTool) Definition

func (WorkerStartupTimeoutTool) Execute

func (WorkerStartupTimeoutTool) Permission

func (WorkerStartupTimeoutTool) Permission() Permission

type WorkerTerminateTool

type WorkerTerminateTool struct {
	Workspace  string
	ConfigHome string
}

func (WorkerTerminateTool) Definition

func (WorkerTerminateTool) Execute

func (WorkerTerminateTool) Permission

func (WorkerTerminateTool) Permission() Permission

type WriteFileTool

type WriteFileTool struct {
	Workspace      string
	AdditionalDirs []string
}

func (WriteFileTool) Definition

func (WriteFileTool) Definition() anthropic.ToolDefinition

func (WriteFileTool) Execute

func (t WriteFileTool) Execute(_ context.Context, input json.RawMessage) (string, error)

func (WriteFileTool) Permission

func (WriteFileTool) Permission() Permission

Jump to

Keyboard shortcuts

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