Skip to main content
Glama

proxy_update_rule

Update an existing interception rule's matcher and handler settings to modify how traffic is intercepted and processed.

Instructions

Modify an existing interception rule.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rule_idYesRule ID to update
descriptionNoNew description
priorityNoNew priority
matcherNoNew matcher config
handlerNoNew handler config

Implementation Reference

  • Registers the 'proxy_update_rule' tool on the MCP server using server.tool(), providing input schema and handler callback.
    server.tool(
      "proxy_update_rule",
      "Modify an existing interception rule.",
      {
        rule_id: z.string().describe("Rule ID to update"),
        description: z.string().optional().describe("New description"),
        priority: z.number().optional().describe("New priority"),
        matcher: matcherSchema.optional().describe("New matcher config"),
        handler: handlerSchema.optional().describe("New handler config"),
      },
      async ({ rule_id, description, priority, matcher, handler }) => {
        try {
          const updates: Record<string, unknown> = {};
          if (description !== undefined) updates.description = description;
          if (priority !== undefined) updates.priority = priority;
          if (matcher !== undefined) updates.matcher = matcher;
          if (handler !== undefined) updates.handler = handler;
    
          const rule = await proxyManager.updateRule(rule_id, updates);
          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 async handler function for 'proxy_update_rule'. It extracts rule_id, description, priority, matcher, and handler from inputs, builds an updates object, calls proxyManager.updateRule(), and returns success/error JSON.
    async ({ rule_id, description, priority, matcher, handler }) => {
      try {
        const updates: Record<string, unknown> = {};
        if (description !== undefined) updates.description = description;
        if (priority !== undefined) updates.priority = priority;
        if (matcher !== undefined) updates.matcher = matcher;
        if (handler !== undefined) updates.handler = handler;
    
        const rule = await proxyManager.updateRule(rule_id, updates);
        return {
          content: [{
            type: "text",
            text: JSON.stringify({ status: "success", rule }),
          }],
        };
      } catch (e) {
        return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: String(e) }) }] };
      }
    },
  • ProxyManager.updateRule() - the core logic that looks up the rule by ID, applies partial updates via Object.assign(), and triggers a mockttp rule rebuild if the proxy is running.
    async updateRule(id: string, updates: Partial<Omit<InterceptionRule, "id" | "hitCount" | "createdAt">>): Promise<InterceptionRule> {
      const rule = this.rules.get(id);
      if (!rule) throw new Error(`Rule '${id}' not found`);
      Object.assign(rule, updates);
      if (this._running) await this.rebuildMockttpRules();
      return rule;
    }
  • Input schema for 'proxy_update_rule': accepts rule_id (required string) plus optional description, priority, matcher, and handler fields.
    {
      rule_id: z.string().describe("Rule ID to update"),
      description: z.string().optional().describe("New description"),
      priority: z.number().optional().describe("New priority"),
      matcher: matcherSchema.optional().describe("New matcher config"),
      handler: handlerSchema.optional().describe("New handler config"),
    },
  • src/index.ts:64-64 (registration)
    Entry point where registerRuleTools(server) is called to register all rule tools including proxy_update_rule.
    registerRuleTools(server);
Behavior2/5

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

No annotations provided, so description must disclose behavior. Fails to clarify if update is partial or full replacement, what happens on invalid rule_id, or whether changes take effect immediately. Lacks side-effect details.

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

Conciseness2/5

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

At 4 words, the description is too brief for a tool with 5 parameters including nested objects. It sacrifices clarity for brevity; should at least mention updatable fields or behavior.

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

Completeness2/5

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

No output schema and no return value description. Missing guidance on success/failure signals, error conditions, or what the tool returns. Incomplete for a mutation tool in a complex domain.

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?

Input schema covers 100% of parameters with descriptions, so baseline is 3. Description adds no additional meaning beyond the schema; it does not explain partial update semantics or required fields beyond rule_id.

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?

Description 'Modify an existing interception rule' uses a specific verb (modify) and resource (existing interception rule), clearly distinguishing from siblings like proxy_add_rule (create), proxy_remove_rule (delete), and proxy_enable_rule/proxy_disable_rule.

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

Usage Guidelines2/5

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

No guidance on when to use this tool vs alternatives. Does not mention that proxy_add_rule should be used for new rules or proxy_remove_rule for deletion. Lacks context on prerequisites or best practices.

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