Skip to main content
Glama

simulate_stateful_failure

Fails the first N intercepted browser requests with an HTTP error, then allows later requests to succeed so you can verify retry and recovery behavior.

Instructions

Opens the browser, navigates to the application, and intercepts requests matching a URL pattern. Fails the first N requests with an error status, then lets subsequent requests succeed. Simulates transient failures and tests retry/recovery logic. Use to answer: does the app retry after a 503 and recover when the service comes back?

Input Schema

NameRequiredDescriptionDefault
urlYesURL of the page to test
wait_msNoMilliseconds to wait after navigation before checking state (default: 2000)
headlessNoWhether to run in headless mode (default: false, launches real browser so user sees application)
viewportNoViewport size (default: 1280×720)
http_statusNoHTTP error status code for the failing requests (default: 503)
failure_countNoNumber of requests to fail before allowing success (default: 3)
success_payloadNoResponse body for requests after the failure window (default: {"ok":true}){"ok":true}
preview_delay_msNoMilliseconds to pause after simulation before closing browser, allowing visual inspection (default: 2000)
fallback_selectorNoCSS selector for the fallback/retry UI that should appear (e.g., '.retry-button')
intercept_patternYesGlob pattern for requests to intercept (e.g., '**/api/data**')
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

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and discloses the core behavior: it opens the browser, navigates, intercepts requests for the first N failures, and then allows success. It omits side-effect details like whether the browser remains open, cleanup behavior, or whether the simulation is safe/destructive, leaving those to the 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?

The four sentences are tightly written and front-loaded: the first explains the core mechanism, the second defines the stateful failure, and the third gives the answering scenario. There is no redundant or filler content.

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 12-parameter tool with no output schema and no annotations, the description is fairly complete on mechanism and usage. However, it does not clarify what the tool returns or how the agent should verify results (e.g., via assert_chaos_handled), which keeps it from a 5.

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 coverage is 100%, so the schema itself documents all 12 parameters. The description provides context for the failure sequence (N failures, error status) but does not add parameter-specific formatting, constraints, or examples beyond what the schema already provides.

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?

The description states a specific verb (intercepts requests) and resource (requests matching a URL pattern), and its stateful fail-first-N-then-succeed behavior is a precise differentiator from generic failure injection. However, it does not name a sibling such as simulate_api_failure or assert_chaos_handled to route the agent, so it falls short of the explicit sibling differentiation a 5 requires.

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?

It provides a clear scenario ('Use to answer: does the app retry after a 503 and recover when the service comes back?') that tells the agent when to use it. It does not, however, mention when not to use it or which sibling to choose for related but different tests, such as stateless failure or post-test assertions.

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