Skip to main content

ToolResultProcessor

Trait ToolResultProcessor 

Source
pub trait ToolResultProcessor: Send + Sync {
    // Required method
    fn process(&self, tool_name: &str, output: &str) -> ProcessedResult;
}
Expand description

Processes tool results before they enter the conversation context.

Implementations receive the tool name (for per-tool dispatch) and the raw output string. They return a ProcessedResult indicating whether the content was modified and providing token estimates for observability.

The processor runs synchronously. For heavyweight transformations (e.g., calling another LLM for semantic extraction), consider doing the work inside the tool handler itself and using the processor only for structural operations.

Required Methods§

Source

fn process(&self, tool_name: &str, output: &str) -> ProcessedResult

Process a tool result, optionally transforming its content.

§Arguments
  • tool_name — The name of the tool that produced this result.
  • output — The raw output string from tool execution.

Return ProcessedResult::unchanged() to pass through unmodified.

Implementors§