Skip to main content
Glama

Dynamic Hook

dynamic_hook

Intercept and modify network requests per browser tab using substring URL matching, with actions to block, fulfill with custom status/body/headers, or continue.

Instructions

Network rule (legacy thin wrapper around route_add). action='block'/'fulfill'/'continue'. url_pattern=substring match. Tab-scoped. For richer matching/modify/HAR use route_add.

Ex: dynamic_hook('t0', '/api/items', 'fulfill', new_status=200, new_body='{"items":[]}')

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": {
      "tab_id": "<tab_id>",
      "url_pattern": "<url_pattern>",
      "action": "<action>"
    },
    "name": "dynamic_hook"
  }
}

Input Schema

NameRequiredDescriptionDefault
actionYes
tab_idYes
new_bodyNo
new_statusNo
new_headersNo
url_patternYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It usefully discloses tab-scoping, substring matching, and legacy status, plus a concrete example of the fulfill path. It omits rule lifecycle behavior (persistence, override ordering, how rules are later removed via `route_remove`) and whether any permissions or session readiness are prerequisites.

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

Conciseness5/5

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

Extremely tight: a parenthetical framing, the action list, match semantics, and a single worked example, with no filler. The most decision-relevant information (legacy status, route_add alternative) is front-loaded.

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?

An output schema exists, so return values need not be explained, and the example covers the main invocation shape. The remaining gap is rule lifecycle and interaction with the route_* family, which the agent must infer from sibling names.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate, and it does: it defines the allowed `action` values, explains that `url_pattern` is a substring match, and the example demonstrates `new_status`/`new_body` usage alongside `tab_id`. Only `new_headers` is left undefined, keeping it just short of full coverage.

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?

The description states the resource (a network rule) and frames the tool precisely as a 'legacy thin wrapper around route_add', immediately distinguishing it from that sibling. It also names the supported actions and matching mode. It stops short of a crisp verb ('register a route rule'), but the resource and scope are unambiguous.

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?

It explicitly routes the agent to `route_add` when richer matching, response modification, or HAR capture is needed, which is a real when-to-use-else rule. It does not spell out when-not-to-use this tool for simple cases, but the implied boundary (simple substring block/fulfill/continue) is clear enough to act on.

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