> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Type Alias Nemo Relay Tool Exec Intercept Cb

> Callback for tool execution intercepts. Receives arguments as JSON plus a `next` callback and its context. Call `next_fn(args, next_ctx)` to invoke the next layer in the middleware chain, or return directly to short-circuit. The `result` and optional `annotation` fields are passed to the remaining middleware and application; `pending_marks` are Relay-owned lifecycle metadata emitted after the tool-end event and are not included in the application-visible result. The returned JSON must contain a `result` field and may contain `annotation` and `pending_marks` fields. The returned string must be allocated with `malloc` or an equivalent allocation compatible with `nemo_relay_string_free`. Ownership transfers to Relay when the callback returns; the callback must not free or reuse the string afterward, and Relay frees it exactly once. Tool execution intercept callback receiving the full call context.

Generated from `cargo doc --no-deps -p nemo-relay -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`.

<pre />

Callback for tool execution intercepts. Receives arguments as JSON plus a `next` callback and its context. Call `next_fn(args, next_ctx)` to invoke the next layer in the middleware chain, or return directly to short-circuit. The `result` and optional `annotation` fields are passed to the remaining middleware and application; `pending_marks` are Relay-owned lifecycle metadata emitted after the tool-end event and are not included in the application-visible result. The returned JSON must contain a `result` field and may contain `annotation` and `pending_marks` fields. The returned string must be allocated with `malloc` or an equivalent allocation compatible with `nemo_relay_string_free`. Ownership transfers to Relay when the callback returns; the callback must not free or reuse the string afterward, and Relay frees it exactly once. Tool execution intercept callback receiving the full call context.

`context_json` is a JSON object with `tool_name`, `args`, and `tool_call_id` fields. `tool_call_id` is `null` when the managed tool call did not record one. New context fields may be added to this object without another ABI change, so callbacks must ignore unknown fields.

The returned JSON must contain a `result` field and may contain `annotation` and `pending_marks`; ownership transfers to Relay on return.