Skip to main content
Glama

network_rules

Idempotent

Block, redirect, stub, or modify browser network requests anywhere, and record/replay API responses with forced errors or latency to test states a real backend won't produce.

Instructions

Network interception, browser-wide, survives reloads until cleared: block, redirect, set/remove headers, stub a synthetic body, or record real API responses and replay them with forced errors/latency (local helper; from HTTPS pages the stub host must be trusted). It changes traffic, while monitor_network only observes it and http_request sends one request; each rule comes back as added, list shows them, clear removes them all.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNoResponse body (action=stub)
nameNoFixture name for record/replay
actionYesrecord saves the page's API responses (url_filter) as a fixture, replay serves them with overrides; list/clear
headerNoHeader name for action=modify_header, e.g. "User-Agent"
statusNoaction=stub
overridesNoreplay: force a status, body or delay on matching URLs — error states a real backend will not produce
url_filterNodeclarativeNetRequest urlFilter, e.g. "||example.com/api/*"
content_typeNoaction=stubapplication/json
header_valueNoOmit to remove header
redirect_urlNoDestination for action=redirect
header_targetNoresponse = strip content-security-policy / x-frame-options, inject CORSrequest
resource_typesNoLimit the rule to these request types; omitted = all of them

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.16.1
    • changedInput schema / properties / action / description
      Previous value: -"list and clear inspect and drop the rules already installed"New value: +"record saves the page's API responses (url_filter) as a fixture, replay serves them with overrides; list/clear"
    • changedInput schema / properties / action / enum
      Previous value: -[
      -  "block",
      -  "redirect",
      -  "modify_header",
      -  "stub",
      -  "list",
      -  "clear"
      -]New value: +[
      +  "block",
      +  "redirect",
      +  "modify_header",
      +  "stub",
      +  "record",
      +  "replay",
      +  "list",
      +  "clear"
      +]
    • addedInput schema / properties / name
      Added value: +{
      +  "description": "Fixture name for record/replay",
      +  "type": "string"
      +}
    • addedInput schema / properties / overrides
      Added value: +{
      +  "description": "replay: force a status, body or delay on matching URLs — error states a real backend will not produce",
      +  "items": {
      +    "properties": {
      +      "body": {
      +        "type": "string"
      +      },
      +      "latency_ms": {
      +        "type": "number"
      +      },
      +      "status": {
      +        "type": "number"
      +      },
      +      "url_contains": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "url_contains"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  2. Changed4 schema fields changedv1.10.0
    • addedInput schema / properties / action / description
      Added value: +"list and clear inspect and drop the rules already installed"
    • addedInput schema / properties / header / description
      Added value: +"Header name for action=modify_header, e.g. \"User-Agent\""
    • addedInput schema / properties / redirect_url / description
      Added value: +"Destination for action=redirect"
    • addedInput schema / properties / resource_types / description
      Added value: +"Limit the rule to these request types; omitted = all of them"
  3. First observedv1.8.0

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=false, destructiveHint=false and idempotentHint=true, and the description adds substantial context beyond them: persistence semantics ('survives reloads until cleared'), a prerequisite ('from HTTPS pages the stub host must be trusted'), and return behavior ('each rule comes back as added, list shows them, clear removes them all'). This is exactly the kind of extra behavioral detail that structured fields cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose and capability list, then constraints and sibling differentiation. Two long, dense sentences pack a lot in with little waste, though the parenthetical constraints interrupt the flow slightly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter tool with no output schema, the description covers capabilities, persistence, a trust prerequisite, and return-behavior ('added'/'list'/'clear'). It stops short of explaining per-action prerequisites, but the schema's 100% coverage fills that gap, leaving the definition largely complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so each of the 12 parameters is already documented. The description loosely maps actions to capabilities but adds no parameter-level detail (formats, defaults, required pairings) beyond what the schema already states, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Network interception, browser-wide') and enumerates the concrete capabilities (block, redirect, set/remove headers, stub, record/replay). It explicitly distinguishes itself from siblings monitor_network and http_request, so an agent can identify it without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Names two alternatives and the condition that separates them: monitor_network 'only observes' traffic while http_request 'sends one request', positioning this tool as the one that changes traffic. Clear context, but it does not spell out when to pick each individual action or when-not to intercept at all.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.