Skip to main content

ResultPostprocessHook

Type Alias ResultPostprocessHook 

Source
pub type ResultPostprocessHook = Arc<dyn Fn(&str, &Value, &str, &ResultCtx) -> Option<String> + Send + Sync>;
Expand description

Hook invoked after every builtin tool produces its text result.

Receives the tool name, the call arguments (as JSON), the result body, and a read-only ResultCtx. Returns Some(footer) to append a steering line (the framework inserts a blank separator line), or None to leave the result byte-for-byte unchanged.

This is the framework’s runtime consumer→agent text channel — the counterpart to the load-once tool descriptions. Consumers supply the domain-aware content: e.g. a graph-backed server can detect a definition-shaped grep pattern (or a zero-match result) and steer the agent to cypher_query. The framework owns the hook; the graph knowledge stays downstream.

Aliased Type§

pub struct ResultPostprocessHook { /* private fields */ }