Type Alias Tool Conditional Fn

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

pub type ToolConditionalFn = Arc<dyn Fn(&str, &Json) -> Result<Option<String>> + Send + Sync>;

Decide whether a tool call is allowed to continue.

The callback receives the tool name and the current argument payload. It can return Ok(None) to allow execution, Ok(Some(reason)) to reject the call with a guardrail message, or an error to abort evaluation entirely.

This alias is Arc-backed so the runtime can clone conditional guardrails into an evaluation snapshot and invoke them after registry locks are released.

Parameters

  • First argument: Tool name being evaluated.
  • Second argument: Current tool argument payload.

Returns

A Result containing Ok(None) when execution is allowed or Ok(Some(reason)) when the guardrail rejects the call.

Errors

The callback can return any FlowError to abort guardrail evaluation.

Aliased Type

1pub struct ToolConditionalFn { /* private fields */ }