simulate_api_failure
Intercept API requests to return error codes and verify fallback UI appears. Test resilience by simulating service failures.
Instructions
Intercepts API requests matching a URL pattern and makes them return an error status code. Navigates to the page and checks if a fallback UI element appears. Use to answer: does the app show a proper error state when the payment API returns 503?
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"url": "<url>",
"intercept_pattern": "<intercept_pattern>"
},
"name": "simulate_api_failure"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of the page to test | |
| wait_ms | No | Milliseconds to wait after navigation before checking the fallback (default: 2000) | |
| viewport | No | Viewport size (default: 1280×720) | |
| status_code | No | HTTP error status code to return (default: 503) | |
| response_body | No | Response body to return for intercepted requests | {"error":"Service Unavailable"} |
| fallback_selector | No | CSS selector for the fallback UI that should appear (e.g., '.error-boundary') | |
| intercept_pattern | Yes | Glob pattern for requests to intercept (e.g., '**/api/payment**') |