Skip to main content
Glama

simulate_api_failure

Simulates API failures by intercepting matching browser requests and returning an error status, then checks whether the app shows the expected fallback UI.

Instructions

Opens the browser, redirects directly to the user application, and intercepts API requests matching a URL pattern to return an error status code. Checks if a fallback UI element appears. Use to answer: does the app show a proper error state when the payment API returns 503?

Input Schema

NameRequiredDescriptionDefault
urlYesURL of the page to test
wait_msNoMilliseconds to wait after navigation before checking the fallback (default: 2000)
headlessNoWhether to run in headless mode (default: false, launches real browser so user sees application)
viewportNoViewport size (default: 1280×720)
status_codeNoHTTP error status code to return (default: 503)
response_bodyNoResponse body to return for intercepted requests{"error":"Service Unavailable"}
preview_delay_msNoMilliseconds to pause after simulation before closing browser, allowing visual inspection (default: 2000)
fallback_selectorNoCSS selector for the fallback UI that should appear (e.g., '.error-boundary')
intercept_patternYesGlob pattern for requests to intercept (e.g., '**/api/payment**')
keep_browser_openNoKeep browser window open after test completes so user can interactively inspect the app (default: false)
api_health_check_urlNoOptional backend or hosted API health check URL to verify before running chaos test. Aborts if backend is down or errors.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.2

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description must carry the load, and it does disclose the action sequence and the visible-browser side effect ("opens the browser, redirects directly to the user application"). It omits other meaningful behavior: that the run aborts when api_health_check_url is down, and what the tool actually reports back about the fallback check, which matters because there is no output schema.

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

Conciseness5/5

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

Three sentences, front-loaded with the mechanism before the use case, with no filler. Every sentence carries information an agent needs.

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

Completeness3/5

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

For an 11-parameter, no-annotation, no-output-schema tool, the description covers the core flow but leaves two gaps: it never says what the result of "checks if a fallback UI element appears" looks like, and it does not mention the health-check abort path. Those are the pieces an agent can't recover from structured fields alone.

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 every one of the 11 parameters, including intercept_pattern, status_code, fallback_selector, and the health-check URL, is already documented. The description echoes the intercept-pattern and status-code concepts but adds no format or constraint detail beyond the schema; baseline 3 applies.

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

Purpose4/5

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

States specific verbs and resources: opens a browser, redirects to the app, intercepts API requests matching a pattern, returns an error status, checks for a fallback UI element. That is far more than a restatement of the name. It does not, however, explicitly contrast itself with siblings like inject_response_corruption or simulate_network_drop, which also perturb responses.

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?

Provides a concrete usage context ("Use to answer: does the app show a proper error state when the payment API returns 503?"), which tells an agent when this tool fits. It stops short of naming alternatives or stating when not to use it, e.g. when you want latency rather than an error code.

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