Mock network responses
network_mockOverride API responses to test hard-to-reproduce states by matching requests with URL regex, then modifying status, headers, body, or latency.
Instructions
Override API responses to test hard-to-reproduce states (Android). Each rule matches requests by URL regex (+ optional method) and can override the status/headers, replace the body, regex-rewrite the live body (change one field, keep the rest), or inject latency. First match wins; rules hot-reload; capture keeps logging (mocked exchanges flagged). Android (Frida/OkHttp): call network_start with app_id first — mocking rides the capture hook (abort not yet supported). iOS response mocking is in development (network_start still captures). replace:true (default) replaces all rules; an empty list clears mocking.
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": {
"device_id": "<device_id>"
},
"name": "network_mock"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rules | No | Mock rules; first match wins. Empty list with replace=true clears all mocks. | |
| replace | No | Replace all rules (true) or append to existing (false) | |
| device_id | Yes | Device id from list_devices (adb serial like 'emulator-5554', or an iOS simulator UDID) |