Skip to main content

ToolExecutor

Trait ToolExecutor 

Source
pub trait ToolExecutor: Send + Sync {
    // Required method
    fn execute<'a>(
        &'a self,
        call: PendingToolCall,
        context: ToolExecutionContext,
    ) -> ToolExecutorFuture<'a>;

    // Provided method
    fn propose<'a>(
        &'a self,
        _call: PendingToolCall,
        _context: ToolExecutionContext,
    ) -> ToolActionProposalFuture<'a> { ... }
}
Expand description

Object-safe runtime tool executor boundary.

The executor returns content and status only. Runtime code records the artifact, emits events, updates the ledger, and resolves the pending call.

Implementations should not call runtime mutation APIs from inside ToolExecutor::execute. The runtime already owns the active-step permit while this method runs.

Required Methods§

Source

fn execute<'a>( &'a self, call: PendingToolCall, context: ToolExecutionContext, ) -> ToolExecutorFuture<'a>

Executes one pending model-requested tool call.

The pending call uses Merry-owned ids, tool names, and arguments rather than provider response structs.

Provided Methods§

Source

fn propose<'a>( &'a self, _call: PendingToolCall, _context: ToolExecutionContext, ) -> ToolActionProposalFuture<'a>

Builds read-only deterministic evidence for a proposed action.

This hook must not mutate workspace, runtime, network, or process state. It exists so runtime can record a provider-neutral proposal before a mutating action is denied, approved, or otherwise reviewed. Existing tools can omit this method; the default returns no proposal.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§