Skip to main content
Glama

proxy_add_rule

Add interception rules to capture, modify, or mock HTTP/HTTPS traffic based on URL, method, headers, or body patterns.

Instructions

Add an interception rule with a matcher and handler. Rules are evaluated by priority (ascending), first match wins.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYesHuman-readable description of this rule
priorityNoPriority (lower = higher priority, default: 100)
matcherYesConditions to match requests
handlerYesWhat to do with matched requests

Implementation Reference

  • The handler implementation for the proxy_add_rule tool, which calls proxyManager.addRule to add the interception rule.
    async ({ description, priority, matcher, handler }) => {
      try {
        const rule = await proxyManager.addRule({
          priority,
          enabled: true,
          description,
          matcher: matcher as RuleMatcher,
          handler: handler as RuleHandler,
        });
        return {
          content: [{
            type: "text",
            text: JSON.stringify({ status: "success", rule }),
          }],
        };
      } catch (e) {
        return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: String(e) }) }] };
      }
    },
  • The registration of the proxy_add_rule tool within the McpServer using server.tool.
    server.tool(
      "proxy_add_rule",
      "Add an interception rule with a matcher and handler. Rules are evaluated by priority (ascending), first match wins.",
      {
        description: z.string().describe("Human-readable description of this rule"),
        priority: z.number().optional().default(100).describe("Priority (lower = higher priority, default: 100)"),
        matcher: matcherSchema.describe("Conditions to match requests"),
        handler: handlerSchema.describe("What to do with matched requests"),
      },
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds some context about rule evaluation (priority-based, first-match-wins), which is useful beyond the input schema. However, it doesn't cover important aspects like whether this is a destructive operation, authentication needs, error handling, or rate limits, leaving gaps for a mutation tool.

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?

The description is extremely concise with two sentences that are front-loaded and waste no words. Every sentence adds value: the first states the purpose, and the second explains rule evaluation behavior, making it efficient and well-structured.

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

Completeness3/5

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

Given the tool's complexity (mutation with nested objects) and no annotations or output schema, the description is incomplete. It covers the basic purpose and rule evaluation but lacks details on behavioral traits, error cases, or return values, which are crucial for an agent to use it correctly in a proxy interception context.

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 the schema already documents all parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, such as examples or constraints. This meets the baseline for high schema coverage but doesn't enhance understanding.

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 clearly states the action ('Add an interception rule') and the components involved ('with a matcher and handler'), which specifies what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'proxy_update_rule' or 'proxy_remove_rule', though the verb 'Add' implies creation versus modification or deletion.

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

Usage Guidelines3/5

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

The description provides some implied context by mentioning rule evaluation ('Rules are evaluated by priority (ascending), first match wins'), which hints at when to use it in relation to other rules. However, it lacks explicit guidance on when to choose this tool over alternatives like 'proxy_update_rule' or prerequisites for use.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yfe404/proxy-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server