Skip to main content
Glama

请求拦截 Mock

browser_mock_requests

Intercepts and mocks HTTP requests in the active tab by matching URL substrings and returning fake status, headers, or bodies. Simulates API responses, errors, and third-party stubs during testing.

Instructions

Intercept and mock HTTP requests of the active tab. Add or replace a rule that matches a URL substring (and optional method); matched requests are answered with a fake status/headers/body instead of reaching the network. Use to simulate API responses, error states, or stub third-party calls during testing. Pass action:"continue" to just observe (log) a matching request without answering it. Returns the rule id and current rules.

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": {
      "urlContains": "<urlContains>"
    },
    "name": "browser_mock_requests"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyNoFake response body text (default empty)
tabIdNoTab id (default: active tab)
actionNorespond=answer with mock (default); continue=just pass through
methodNoOnly mock this HTTP method (e.g. GET/POST). Omit to match any.
statusNoFake response status code (default 200)
headersNoFake response headers (optional)
urlContainsYesSubstring of request URL to match (case-insensitive), e.g. "/api/v1/quote"

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.15.0

TDQS

A3.6/5.0
Behavior3/5

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

The description adds real value beyond the annotations: matched requests are answered instead of reaching the network, rules can add-or-replace, and the return is 'the rule id and current rules'. But with destructiveHint=false and readOnlyHint=false the mutation profile is barely covered, and it omits how rules are removed, whether they survive navigation/reload, and whether they apply to all tabs or only the active one.

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?

Four sentences, front-loaded with the verb and mechanism, then use cases, then the pass-through variant, then the return value. Dense and purposeful, with only mild overlap between sentence one and sentence two.

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 7-parameter mutation tool with no output schema, the description covers mechanism, use case, the continue mode, and the return payload. The remaining gap is lifecycle: how rules are cleared or scoped, which matters for a tool that alters network behavior.

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 coverage is 100% with per-property descriptions and an enum for action, so the schema already carries parameter meaning. The description restates the URL-substring match, optional method, and fake status/headers/body without adding format details or defaults beyond what the schema declares; baseline 3 applies.

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

Purpose4/5

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

States a specific verb and resource ('Intercept and mock HTTP requests of the active tab') and narrows it further to 'add or replace a rule' that matches a URL substring. This clearly separates it from the read-only network tools, but it never names browser_list_mocks, browser_clear_mocks, or browser_network_requests, so the sibling boundary has to be inferred.

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?

'Use to simulate API responses, error states, or stub third-party calls during testing' gives concrete when-to-use context, and the 'action:continue' sentence describes an in-tool alternative mode of operation. It stops short of saying when to prefer a different tool (e.g., for browsing existing rules) or what preconditions apply.

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