Skip to main content
Glama

updateRule

Modify rule content on the Whistle MCP Server to manage proxy settings, enabling precise control over network request rules and configurations.

Instructions

更新规则内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ruleNameYes规则名称
ruleValueYes规则内容

Implementation Reference

  • MCP handler implementation for the 'updateRule' tool, including inline schema validation via Zod and delegation to WhistleClient.updateRule
    server.addTool({
      name: "updateRule",
      description: "更新规则内容",
      parameters: z.object({
        ruleName: z.string().describe("规则名称"),
        ruleValue: z.string().describe("规则内容"),
      }),
      execute: async (args) => {
        const { ruleName, ruleValue } = args;
        const result = await whistleClient.updateRule(ruleName, ruleValue);
        return formatResponse(result);
      },
    });
  • Supporting helper method in WhistleClient that implements the core logic for updating a Whistle rule by posting form data to the appropriate Whistle API endpoint (enable-default for default rule, select for others)
    async updateRule(ruleName: string, ruleValue: string): Promise<any> {
      const isDefaultRule = ruleName.toLowerCase() === "default";
      const formData = new URLSearchParams();
      formData.append("clientId", `${Date.now()}-0`);
      formData.append("name", ruleName);
      formData.append("value", ruleValue);
      formData.append("selected", "true");
      formData.append("active", "true");
      formData.append("key", `w-reactkey-${Math.floor(Math.random() * 1000)}`); // Generate a random key
      formData.append("hide", "false");
      formData.append("changed", "true");
    
      const endpoint = isDefaultRule
        ? `${this.baseUrl}/cgi-bin/rules/enable-default`
        : `${this.baseUrl}/cgi-bin/rules/select`;
    
      const response = await axios.post(endpoint, formData, {
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
      });
      return response.data;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'update' implying a mutation, but does not disclose any behavioral traits such as permissions required, whether changes are reversible, side effects, error handling, or rate limits. This is a significant gap for a mutation tool with zero annotation coverage.

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?

The description is a single phrase '更新规则内容', which is extremely concise and front-loaded. However, it is under-specified rather than efficiently informative, lacking necessary details for a mutation tool. It earns a 4 for brevity but loses points for not using its minimal space effectively.

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?

Given the tool's complexity as a mutation operation, lack of annotations, no output schema, and multiple sibling tools, the description is incomplete. It fails to address key aspects like what 'rule content' includes, how updates affect the system, or what the tool returns. This inadequacy hinders effective agent use.

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%, with both parameters ('ruleName' and 'ruleValue') documented in the schema. The description adds no meaning beyond the schema, as it does not explain parameter relationships, formats, or examples. Baseline score of 3 applies since the schema does the heavy lifting, but no extra value is provided.

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

Purpose2/5

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

The description '更新规则内容' (Update rule content) restates the tool name 'updateRule' in Chinese, making it essentially tautological. It specifies the verb 'update' and resource 'rule content' but lacks specificity about what 'rule content' entails or how it differs from similar tools like 'renameRule' or 'disableRule'. No sibling differentiation is provided.

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?

The description offers no guidance on when to use this tool versus alternatives. With siblings like 'renameRule', 'disableRule', 'setAllRulesState', and 'updateValue', there is no indication of prerequisites, context, or exclusions. Usage is implied only by the generic term 'update', which is insufficient for clear decision-making.

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

Related 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/7gugu/whistle-mcp'

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