Reference
Tool and Response Assertions
Assertion guide with examples for tool usage, tool inputs and outputs, final responses, and agent judge checks.
When To Use Tool vs Response Assertions
- Use tool assertions when behavior depends on action correctness (which tools were called, and in which order).
- Use tool input assertions to check arguments and tool output assertions to check what the MCP server returned.
- Use response assertions when behavior depends on final answer quality or format.
- Use agent checks (agent judge) when the validation is semantic or fuzzy and strict string/regex checks would be too brittle.
- Use both together for high-confidence checks: action correctness plus answer correctness.
Tool Assertions
Tool assertions validate whether the agent used the right tools and, when needed, whether they were called in the right order.
These checks look at the observed tool-call list for a run. They do not inspect the final answer text.
- Use
required_toolswhen a tool call is mandatory for the scenario to pass. - When the LLM can use either of several tools to achieve the same result, put those names in one
required_toolsentry separated by|, for examplesearch | lookup. The check passes if the agent calls any one of them. - Use
forbidden_toolswhen a tool call would be unsafe, irrelevant, or should not appear in a valid solution. - Every
tool_sequencestep must appear in order, but other tool calls may happen between the listed steps. - Repeated tools are matched from left to right, so
tool_sequence: [search, search, summarize]requires two separatesearchcalls beforesummarize. - A
tool_sequencestep can also list alternatives with|; every step must still appear in order. forbidden_toolsentries name one tool and do not support|. Empty or duplicate alternatives are invalid. If every alternative is forbidden, validation fails; if only some are forbidden, MCPLab warns you.- MCPLab reports each alternative group as one check.
eval:
tool_constraints:
required_tools: [lookup_account, verify_identity]
forbidden_tools: [delete_account]eval:
tool_sequence:
- lookup_account
- verify_identity
- process_refundeval:
tool_constraints:
required_tools: [authenticate, search | lookup]
tool_sequence:
- search | lookup
- summarizeResponse Assertions
Response assertions validate the final answer text.
Literal string checks are case-insensitive by default. Use regex only when you need pattern matching, and use JSONPath when the model must return structured JSON.
- Use
containsfor a phrase that should appear anywhere in the final response. - Use
not_containsfor words or phrases that must not appear. - Use
starts_with,ends_with, orequalswhen the response format is mostly fixed. - Use
regexfor variable text such as IDs, timestamps, alternations, or optional wording. - Use
jsonpath,jsonpath_exists, andjsonpath_not_existsonly when the final response is valid JSON.
eval:
response_assertions:
- type: contains
value: refund processedeval:
response_assertions:
- type: not_contains
value: internal erroreval:
response_assertions:
- type: starts_with
value: helloeval:
response_assertions:
- type: ends_with
value: thank youeval:
response_assertions:
- type: equals
value: successeval:
response_assertions:
- type: regex
pattern: 'refund\s+(processed|completed)'eval:
response_assertions:
- type: jsonpath
path: $.status
- type: jsonpath
path: $.status
equals: successeval:
response_assertions:
- type: jsonpath_exists
path: $.data.ideval:
response_assertions:
- type: jsonpath_not_exists
path: $.errorTool Input Assertions
Tool input assertions validate the arguments sent to a specific MCP tool. Set tool to the raw MCP tool name, without a server prefix. When the same tool is called more than once, an assertion passes if any matching call satisfies it.
Use contains for simple, case-insensitive text matching anywhere in the serialized input. Use regex for pattern matching. Use jsonpath when you need to inspect a specific structured value; omit equals to require that the path exists.
containsusesvalueand is the simplest choice for required text such as an identifier, query term, or date.regexusespatternas a JavaScript regular expression and is useful for variable formats.jsonpathusespathand an optionalequalsvalue. Equality is checked against the resolved primitive value and supports strings, numbers, and booleans.- Use deterministic tool input assertions for exact argument requirements. Use an Agent Judge with tool-input context when the input needs semantic interpretation.
eval:
tool_input_assertions:
- type: contains
tool: search_tags
value: TM5-BP2eval:
tool_input_assertions:
- type: regex
tool: search_tags
pattern: "TM5-BP2-[A-Z0-9.-]+"eval:
tool_input_assertions:
- type: jsonpath
tool: search_tags
path: $.query
- type: jsonpath
tool: search_tags
path: $.limit
equals: 20
- type: jsonpath
tool: search_tags
path: $.include_archived
equals: falseTool Output Assertions
Use eval.tool_output_assertions to validate the result returned by a specific MCP tool. These deterministic checks use the same fields as tool input assertions and do not require an Evaluation Judge. Set tool to the raw MCP tool name, without a server prefix.
Checks inspect the full MCP response, including content, structuredContent, and isError when present. JSONPath starts at that response object. JSON embedded inside a text content item remains a string; it is not automatically parsed into a structured object.
containsmatchesvalueanywhere in the JSON-serialized output, ignoring case.regexmatchespatternagainst the JSON-serialized output using a JavaScript regular expression. Tool input and output regex checks are case-sensitive unless the pattern handles both cases.jsonpathevaluatespathagainst the response object. Omitequalsto require at least one resolved value, or set it to a string, number, or boolean for exact equality. Values such as5andfalseretain their types.- When a tool is called repeatedly, each assertion passes if any matching call satisfies it. Separate assertions can match different calls; they do not require every call to pass.
- A check fails if the tool was not called, its output is unavailable, or no output matches. A later matching call can still pass even if earlier outputs are missing. Invalid regex patterns and JSONPath evaluation errors are reported as failed checks.
- Rover browser runs do not supply MCP tool observations, so these checks are marked
not_evaluated. See Rover Results.
{
"content": [{ "type": "text", "text": "Found TM5-BP2" }],
"structuredContent": { "total": 5, "ok": false },
"isError": false
}eval:
tool_output_assertions:
- type: contains
tool: search_tags
value: TM5-BP2
- type: regex
tool: search_tags
pattern: 'TM5-BP[0-9]+'
- type: jsonpath
tool: search_tags
path: $.content[0].text
- type: jsonpath
tool: search_tags
path: $.structuredContent.total
equals: 5
- type: jsonpath
tool: search_tags
path: $.isError
equals: falseAgent Checks (Agent Judge)

Agent checks evaluate the final answer against a short freeform instruction. They are useful for semantic validation such as “does this answer include a valid time range?” when deterministic string checks are too rigid. A workspace-configured Evaluation Judge evaluates them, or an optional Decision Engine evaluates them first and sends uncertain or unavailable decisions to the judge. See Judge & Decision Engine for configuration and routing.
By default, semantic evaluation receives only the final answer. Use the optional agent_context block to send additional context: the original scenario prompt, called tool names, or tool names with their arguments. This context is shared across all semantic checks in the scenario and used by both evaluators when available.
eval:
agent_assertions:
- label: logical_time_range
prompt: Confirm the final answer includes an earliest and latest timestamp, and that both values are present and logically ordered.eval:
agent_context:
include_prompt: true # includes the scenario prompt
include_tool_sequence: true # includes called tool names when available
include_tool_inputs: true # includes tool names and arguments when available
agent_assertions:
- label: addresses_question
prompt: Confirm the answer directly addresses the original question.
- label: logical_time_range
prompt: Confirm the final answer includes an earliest and latest timestamp, and that both values are present and logically ordered.Behavior Notes and Edge Cases
- required_tools passes when each listed tool appears at least once in the run, in any order.
- forbidden_tools fails when any listed tool appears in the run.
- tool_sequence is an ordered subsequence check: listed tools must appear in order, but other tools may appear between them.
- contains/not_contains/starts_with/ends_with/equals are literal, case-insensitive string checks.
- Response regex is case-insensitive by default. Tool input and output regex checks use case-sensitive JavaScript regular expressions.
- jsonpath/jsonpath_exists/jsonpath_not_exists require valid JSON in the final response.
- If final response is not valid JSON, JSONPath assertions fail with an invalid JSON error.
- Agent checks require a default LLM Evaluation Judge in workspace settings. Without a Decision Engine, they use one batched judge request per scenario run. With an engine, clear verdicts are accepted and only fallback assertions are collected into a judge request.
- agent_context is optional and applies to all agent_assertions in the scenario. Omit it to evaluate the final answer only (default).
- include_prompt sends the scenario prompt as context.scenario_prompt. include_tool_sequence sends the called tool names as context.tool_sequence. include_tool_inputs sends tool names and arguments as context.tool_inputs.
- agent_context fields default to false; omitting the block entirely is equivalent to all three fields being false.
- Agent checks are more flexible, but they are also less reproducible and more expensive than deterministic checks.