# Tool Invocation and mocks

Tool Invocation tests verify structured action behavior: a specific Tool call, any Tool call, absence of an action, parameter conditions, or a Workflow node transition. They capture runtime evidence **without executing the captured Tool over HTTP**, preventing the assertion itself from causing an external side effect.

## Select the expected action

Choose one referenced Tool or one Workflow transition. A referenced Tool records both its identifier and supported type. A transition records the Agent and target node. Leaving **Tool to test** as `null` means the run passes only when there are no captured calls at all. With a target selected, `verify_absence` means that specific Tool or transition must not occur.

`check_any_tool_matches: true` passes when any matching candidate satisfies every parameter condition. When it is `false`, exactly one call must have been captured before that candidate can pass. Parameter conditions provide four matchers: `anything`, `exact`, `regex`, and `llm`. Regex uses a full match and times out safely; the LLM matcher makes an additional billable evaluator request. Use exact checks for identifiers, enum values, and amounts.

## Understand capture behavior

The test interceptor records all candidate calls, including malformed calls and built-in or transition actions needed for evidence. Captured webhook and Workflow Tool calls do not perform HTTP. A malformed call still counts as an attempted call and can fail the condition instead of disappearing from the result.

Direct Agent Tools, Procedure Tools, and Workflow Tools pass through the same runtime interceptor and produce the same captured-or-mocked source evidence. This makes a run explainable across Agent behavior, Procedure steps, and Workflow nodes without a hidden execution path.

## Configure response mocks

Response mocks are authored on a Tool in the Tool editor and can be overridden inside a Simulation. For one Tool call, Operade checks test overrides first, then shared Tool mocks, in displayed order; the first response whose parameter conditions all match wins. Reordering mocks therefore changes behavior.

Simulation can mock all Tools, selected Tools, or none. The safe default is **all** with `raise_error` when no response matches. Choosing `call_real_tool` permits the unmatched call to reach the integration.

Next Reply always uses the shared Tool response mocks with the safe all-plus-`raise_error` policy. It does not use Simulation overrides and never falls back to a real webhook. An unmatched call stops that run with `mock_not_matched`.

Choosing `call_real_tool` or mocking none in Simulation can execute a real integration with live Secret values. Review [Usage, safety, and limits](/docs/agent-testing/usage-safety-and-limits) before enabling that path. For Tool configuration behavior outside tests, see [Tool runtime](/docs/tools/end-call-and-runtime).
