browser_intercept_request
Intercept and modify outgoing browser requests in real-time via Chrome CDP. Inject custom headers or block matching URLs using regex patterns.
Instructions
Intercept and modify OUTGOING browser requests in real-time via Chrome CDP Fetch API.
PREREQUISITE: browser_open must have been called first.
IMPORTANT — This is DIFFERENT from add_interception_rule (proxy-level):
browser_intercept_* = instant, browser-only, via Chrome CDP. Changes take effect immediately.
add_interception_rule = proxy-level, ~5s cache delay, applies to ALL traffic (browser + code-mode).
Available actions:
"inject_header": Add a custom header to matching requests. Example: browser_intercept_request(url_pattern=".api.", action="inject_header", key="X-Admin", value="true")
"block": Block matching requests entirely (returns network error to the page). Example: browser_intercept_request(url_pattern=".analytics.", action="block")
Args: url_pattern: Regex pattern to match request URLs (e.g. ".api.target.com.") action: "inject_header" or "block" key: Header name (required for inject_header) value: Header value (required for inject_header) session_name: Browser session to use (default: "default")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | ||
| value | No | ||
| action | Yes | ||
| url_pattern | Yes | ||
| session_name | No | default |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |