Skip to main content
Glama

Answer a request from a rule instead of the server

qa_mock

Override matching fetch/XHR responses in a tab with custom status, body, delay, or network failure to test error paths, empty payloads, and retry behavior.

Instructions

Override what the app RECEIVES from the network — the thing DevTools calls a local override, driven from here. Set a rule and the page's next matching fetch/XHR is answered by it: your status, your body, optionally after a delay, or as an outright network failure. This is how you test the paths a server will not produce on demand: an empty list, a 500, a 403 that should log the user out, a 30-second response that should show a spinner, a malformed payload, a field the API does not return yet. op:'list' is free and READS the rules in force; set / remove / toggle / clear change what the app sees and need the Agent control consent, because an app fed an invented 200 can persist it. MATCHING: url is a substring of the full URL, or /regex/flags when you wrap it in slashes; method defaults to any. First matching enabled rule wins. times spends the rule after N answers (leave it out for unlimited) — that is how you make the FIRST call fail and the retry succeed. LIFETIME: a rule belongs to ONE TAB, survives reloads of it, and is gone when it closes. It is not in force in any other tab. WHAT IT DOES NOT CATCH, so you do not debug a rule that was never consulted: only the page's own fetch/XHR in the top frame. Not the HTML document itself, not images/scripts/stylesheets, not WebSocket or EventSource, not sendBeacon, not requests made inside an iframe or from the page's own service worker. Mocked responses are logged as (mocked) in the session, the HAR and the report — a value you invented is never presented as the server's. Remember to clear rules when you are done; a forgotten mock is the most expensive thing here.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "qa_mock"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoRule id, for remove / toggle / editing an existing rule
opNoDefault 'set'
urlNoSubstring of the request URL, or /regex/flags
bodyNoResponse body, verbatim. JSON-looking bodies get a JSON content-type unless you set one
failNoFail at the network level (fetch rejects, XHR fires error) instead of answering
noteNoWhy this rule exists — shown to the human in the panel
tabIdNoTarget tab (from qa_tabs); omit for the active tab
timesNoApply at most N times, then let the real request through
methodNoGET / POST / … — omit to match any method
statusNoStatus to answer with (default 200)
delayMsNoHold the answer back this long — for spinners and timeouts (max 60000)
enabledNoFor op:'toggle'
headersNoResponse headers

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.86.2

TDQS

A4.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does substantial work: consent needs, tab-scoped lifetime surviving reloads, first-match-wins, and mocked responses logged as '(mocked)'. However, it omits some behaviors a caller would want, such as what happens on conflicts between overlapping rules or the practical ceiling for delay beyond the schema's max. It is rich but not exhaustive for a mutation tool with zero annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Information is front-loaded — the core purpose comes first, then matching, lifetime, and exclusions in clearly labeled blocks. It is long and dense, and a few clauses (e.g., the closing reminder about clearing rules) restate what lifetime already implies, but nearly every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter tool with no output schema and no annotations, the description supplies the behavioral context an agent needs: consent for mutating ops, rule scoping and lifetime, matching precedence, times semantics, and the exclusion list. Nothing critical to calling it correctly appears to be missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents each parameter, setting the baseline at 3. The description adds genuine meaning beyond it: the substring-vs-/regex/flags matching rule, method defaulting to any, first-matching-enabled-rule-wins precedence, and the semantics of 'times' spending a rule after N answers (first call fail, retry succeed). That is real value over the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a concrete verb-and-resource framing: it overrides what the app receives from the network, matching fetch/XHR, and states it is the 'local override' concept from DevTools. The one-sentence summary plus the enumerated test scenarios ('empty list, a 500, a 403 that should log the user out') leave no ambiguity about what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly names when to use it (test paths a server won't produce on demand) and gives concrete examples. It also names an explicit exclusion boundary — 'WHAT IT DOES NOT CATCH' — listing HTML documents, images, scripts, WebSocket, EventSource, sendBeacon, iframes, and service workers, so an agent won't chase a rule that was never consulted. Consent requirements for mutating ops vs the free read-only 'list' are also called out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.