Skip to navigation

Function register_tool_execution_intercept

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.

pub fn register_tool_execution_intercept(
    name: &str,
    priority: i32,
    callable: Arc<dyn Fn(ToolExecutionContext, Arc<dyn Fn(Value) -> Pin<Box<dyn Future<Output = Result<ToolExecutionResult, FlowError>> + Send>> + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<ToolExecutionInterceptOutcome, FlowError>> + Send>> + Sync + Send>,
) -> Result<(), FlowError>

Register a global tool execution intercept that receives the full ToolExecutionContext, including the managed tool_call_id. Execution intercepts can wrap or replace the tool callback. Each callback returns a canonical tool execution outcome, while its continuation resolves to the downstream ToolExecutionResult.

Parameters

  • name: Unique middleware name in the global registry.
  • priority: Lower values run earlier in the chain.
  • callable: Execution intercept callback stored under name.

Returns

A Result that is Ok(()) when the intercept was registered.

Errors

Returns FlowError::AlreadyExists when the name is already in use or an internal error if the runtime state cannot be updated.