intercept_network
Manage network requests by blocking or mocking with URL glob patterns. Add rules and call refresh() to apply them on page load.
Instructions
Manage network interception rules. Block or mock requests matching URL glob patterns. Rules are additive — each call adds a rule. Use refresh() after adding rules to replay the page load with rules active.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | block: abort matching requests. mock_response: return synthetic response. remove_rule: remove by rule_id. clear_all: remove all rules. | |
| mock | No | Synthetic response for mock_response action. | |
| pattern | No | URL glob matched against the full request URL. '*' matches across path separators (e.g. '*ads.com*' blocks any URL containing ads.com; '*/api/v2/*' matches that path on any host). Prefix with 're:' for a regular expression (e.g. 're:api/v[0-9]+'). Required for block/mock_response. | |
| rule_id | No | Rule ID to remove (for remove_rule action). |