Skip to main content
Glama

Mock network route

mock_route

Intercept browser requests matching a URL pattern to return canned responses, errors, or delays, enabling UI tests for API failures and timeouts without contacting the real server.

Instructions

Intercept browser requests matching a URL glob and answer them with a canned response, an error, or a delay, without contacting the real server. Tests UI behavior for API errors, payment declines, timeouts and outages. Only the browser sees the mock; no backend is contacted. Mocks persist until clear_mocks.

Input Schema

NameRequiredDescriptionDefault
bodyNoRaw body text (ignored when json is given)
jsonNoJSON body (sets content-type application/json)
abortNoFail the request with this network error instead of responding
timesNoOnly mock the first N matching requests
methodNoOnly mock this HTTP method
statusNoHTTP status to return
delayMsNoDelay before responding
headersNoExtra response headers
urlPatternYesGlob matched against the full URL, e.g. "**/api/checkout*" or "https://api.example.com/v1/**"
contentTypeNoContent-Type for a raw body (default text/plain)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=false and openWorldHint=false, so the description carries most of the burden and does well: it explains the browser-only scoping, that no backend is contacted, and crucially that mocks persist until clear_mocks. It doesn't state what the tool returns (e.g., a handle/id) or precedence when multiple mocks match the same URL, which would complete the picture.

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?

Front-loaded with the core action and four tight sentences. Minor redundancy: 'without contacting the real server' and 'no backend is contacted' restate the same fact, so one of them could be cut.

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

Completeness4/5

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

For a 10-parameter mutation-style tool with no output schema, the description covers the essential behavior: interception scope, persistence, and browser-only effect. It could say more about mock precedence and whether the call returns a reference, but an agent has enough to invoke it correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description reinforces the urlPattern glob semantics and maps loosely onto the status/body/abort/delayMs modes, but adds no syntax or format detail beyond what the schema already documents.

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?

States a specific verb (intercept) and resource (browser requests matching a URL glob), plus the three response modes: canned response, error, or delay. It is clearly distinguishable from siblings like get_network_requests and clear_mocks, the latter named explicitly.

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

Usage Guidelines4/5

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

Gives concrete usage scenarios (API errors, payment declines, timeouts, outages) and names clear_mocks as the cleanup path. It lacks an explicit 'when not to use this vs. get_network_requests' exclusion, but the context is unambiguous.

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