Skip to main content

Tool

Trait Tool 

pub trait Tool:
    Send
    + Sync
    + Attributable {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn parameters_schema(&self) -> Value;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        args: Value,
    ) -> Pin<Box<dyn Future<Output = Result<ToolResult, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn requires_unrestricted_principal(&self) -> bool { ... }
    fn output_schema(&self) -> Option<Value> { ... }
    fn param_domains(&self) -> Vec<(&'static str, OptionDomain)> { ... }
    fn invocation_triggers(&self) -> Vec<String> { ... }
    fn execute_with_context<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: Value,
        context: &'life1 ToolExecutionContext,
    ) -> Pin<Box<dyn Future<Output = Result<ToolResult, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
    fn spec(&self) -> ToolSpec { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Tool name (used in LLM function calling)

Source

fn description(&self) -> &str

Human-readable description

Source

fn parameters_schema(&self) -> Value

JSON schema for parameters

Source

fn execute<'life0, 'async_trait>( &'life0 self, args: Value, ) -> Pin<Box<dyn Future<Output = Result<ToolResult, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Execute the tool with given arguments

Provided Methods§

Source

fn requires_unrestricted_principal(&self) -> bool

True when this tool starts nested execution without carrying the RPC principal’s current tool and agent ceilings. Constrained RPC sessions must omit it. Wrappers forward the target’s value so a renamed skill cannot bypass that restriction. This describes implementation support, not a stored authorization decision.

Source

fn output_schema(&self) -> Option<Value>

JSON schema describing the structured output this tool attaches to ToolOutput::data, when it declares one. None means the tool emits display text only; authoring surfaces fall back to sample-derived shapes from captured runs.

Source

fn param_domains(&self) -> Vec<(&'static str, OptionDomain)>

Option domains for parameters whose value sets live in runtime config rather than the static schema (channel refs, peer targets, …). Surfaces resolve these through the runtime to render real selectable choices. Default: no domain-typed parameters.

Source

fn invocation_triggers(&self) -> Vec<String>

Lowercase phrases that suggest an inbound message wants this tool — e.g. routing wording or configured destination names for a delivery tool. A pre-turn prefilter may scan the message against these and nudge the model to consider the tool; the tool itself is never called by the prefilter.

Matching contract: case-insensitive, word-boundary — a trigger matches only where it is bounded by non-alphanumeric characters or the message ends (see invocation_trigger_matches). So dev does not fire inside device and ops does not fire inside stops; a trigger only hits as a whole word or phrase. Entries should still be wording that, taken whole, indicates this tool — avoid single common words. A config-derived name that happens to equal a common word can still over-fire; the hint is advisory (the model, not the prefilter, decides to call), so the cost of a false positive is a wasted nudge, never an action. Entries derived from runtime config (aliases, group names) must be computed live per call, never cached across reloads. Default: no triggers; the tool does not participate in prefilter hints.

Source

fn execute_with_context<'life0, 'life1, 'async_trait>( &'life0 self, args: Value, context: &'life1 ToolExecutionContext, ) -> Pin<Box<dyn Future<Output = Result<ToolResult, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Execute with turn-scoped cancellation while preserving legacy tools. Tools that start child work can override this method to pass the context or a child token explicitly, and use ToolExecutionContext::run to scope and cancel their execution future.

Source

fn spec(&self) -> ToolSpec

Assemble this tool’s spec. The default recomposes it from parameters_schema() and allocates a fresh Arc per call, so tools with large stored schemas override it to hand out Arc::clone instead (see McpToolWrapper). Delegating wrappers around a dyn Tool MUST forward spec() to the inner tool — relying on this default silently reintroduces a per-iteration deep clone of the inner schema and breaks Arc identity for downstream sharing.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Tool for EchoTool

Source§

fn name(&self) -> &str

Source§

fn description(&self) -> &str

Source§

fn parameters_schema(&self) -> Value

Source§

fn execute<'life0, 'async_trait>( &'life0 self, args: Value, ) -> Pin<Box<dyn Future<Output = Result<ToolResult, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, EchoTool: 'async_trait,

Implementors§

Source§

impl Tool for A2aCancelTool

Source§

impl Tool for A2aDiscoverTool

Source§

impl Tool for A2aGetTaskTool

Source§

impl Tool for A2aSendTool

Source§

impl Tool for ArcToolRef

Source§

impl Tool for AskUserTool

Source§

impl Tool for BackupTool

Source§

impl Tool for CalculatorTool

Source§

impl Tool for CanvasTool

Source§

impl Tool for ChannelRoomTool

Source§

impl Tool for CloudOpsTool

Source§

impl Tool for CloudPatternsTool

Source§

impl Tool for ContentSearchTool

Source§

impl Tool for CronAddTool

Source§

impl Tool for CronListTool

Source§

impl Tool for CronRemoveTool

Source§

impl Tool for CronRunTool

Source§

impl Tool for CronRunsTool

Source§

impl Tool for CronUpdateTool

Source§

impl Tool for DataManagementTool

Source§

impl Tool for DelegateTool

Source§

impl Tool for DeliverFileTool

Source§

impl Tool for DiscordSearchTool

Source§

impl Tool for EscalateToHumanTool

Source§

impl Tool for FileDownloadTool

Source§

impl Tool for FileEditTool

Source§

impl Tool for FileReadTool

Source§

impl Tool for FileUploadBundleTool

Source§

impl Tool for FileUploadTool

Source§

impl Tool for FileWriteTool

Source§

impl Tool for GitForgeTool

Source§

impl Tool for GitOperationsTool

Source§

impl Tool for GlobSearchTool

Source§

impl Tool for HardwareBoardInfoTool

Source§

impl Tool for HardwareMemoryMapTool

Source§

impl Tool for HardwareMemoryReadTool

Source§

impl Tool for HttpRequestTool

Source§

impl Tool for ImageInfoTool

Source§

impl Tool for KnowledgeTool

Source§

impl Tool for LlmTaskTool

Source§

impl Tool for McpPromptsTool

Source§

impl Tool for McpResourcesTool

Source§

impl Tool for McpToolWrapper

Source§

impl Tool for MemoryExportTool

Source§

impl Tool for MemoryForgetTool

Source§

impl Tool for MemoryPurgeTool

Source§

impl Tool for MemoryRecallTool

Source§

impl Tool for MemoryStoreTool

Source§

impl Tool for ModelRoutingConfigTool

Source§

impl Tool for ModelSwitchTool

Source§

impl Tool for NodeTool

Source§

impl Tool for PipelineTool

Source§

impl Tool for PollTool

Source§

impl Tool for ProxyConfigTool

Source§

impl Tool for ReactionTool

Source§

impl Tool for ReadSkillTool

Source§

impl Tool for ScheduleTool

Source§

impl Tool for SecurityOpsTool

Source§

impl Tool for SendMessageToPeerTool

Source§

impl Tool for SendViaTool

Source§

impl Tool for SessionDeleteTool

Source§

impl Tool for SessionResetTool

Source§

impl Tool for SessionsCurrentTool

Source§

impl Tool for SessionsHistoryTool

Source§

impl Tool for SessionsListTool

Source§

impl Tool for SessionsSendTool

Source§

impl Tool for ShellTool

Source§

impl Tool for SkillBuiltinTool

Source§

impl Tool for SkillHttpTool

Source§

impl Tool for SkillManageTool

Source§

impl Tool for SkillShellTool

Source§

impl Tool for SkillViewTool

Source§

impl Tool for SkillsListTool

Source§

impl Tool for SopAdvanceTool

Source§

impl Tool for SopApproveTool

Source§

impl Tool for SopExecuteTool

Source§

impl Tool for SopListTool

Source§

impl Tool for SopStatusTool

Source§

impl Tool for SopWorkshopTool

Source§

impl Tool for SpawnSubagentTool

Source§

impl Tool for TodoWriteTool

Source§

impl Tool for ToolSearchTool

Source§

impl Tool for VerifiableIntentTool

Source§

impl Tool for WebFetchTool

Source§

impl<T> Tool for PathGuardedTool<T>
where T: Tool,

Source§

impl<T> Tool for RateLimitedTool<T>
where T: Tool,