intercept_network
Manage network interception rules to block or mock HTTP requests using URL glob patterns or regex. Rules are additive; call refresh() to replay page load with active rules.
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 |
|---|---|---|---|
| mock | No | Synthetic response for mock_response action. | |
| action | Yes | block: abort matching requests. mock_response: return synthetic response. remove_rule: remove by rule_id. clear_all: remove all rules. | |
| 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). |