Skip to main content
Glama

disableRule

Disable specific proxy rules in Whistle MCP Server by providing the rule name, allowing precise control over network request management.

Instructions

禁用规则

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ruleNameYes规则名称

Implementation Reference

  • The main handler function that implements disabling a rule. It retrieves the rule details, constructs form data, and sends a POST request to Whistle's API endpoint (/cgi-bin/rules/unselect or /disable-default) to unselect/disable the specified rule.
    async unselectRule(ruleName: string): Promise<any> {
      const rules = await this.getRules();
    
      if (!rules) {
        throw new Error("No rules found");
      }
    
      const isDefaultRule = ruleName.toLowerCase() === "default";
      let ruleContent;
    
      if (isDefaultRule) {
        ruleContent = rules.defaultRules;
      } else {
        const rule = rules.list.find((rule: any) => rule.name === ruleName);
        if (!rule) {
          throw new Error(`Rule with name '${ruleName}' not found`);
        }
        ruleContent = rule.data;
      }
    
      const formData = new URLSearchParams();
      formData.append("clientId", `${Date.now()}-0`);
      formData.append("name", ruleName);
      formData.append("value", ruleContent);
      formData.append("selected", "true");
      formData.append("active", "true");
      formData.append("key", `w-reactkey-${Math.floor(Math.random() * 1000)}`);
      formData.append("hide", "false");
      formData.append("changed", "true");
    
      const endpoint = isDefaultRule
        ? `${this.baseUrl}/cgi-bin/rules/disable-default`
        : `${this.baseUrl}/cgi-bin/rules/unselect`;
    
      const response = await axios.post(endpoint, formData, {
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
      });
    
      return response.data;
    }
  • src/index.ts:106-116 (registration)
    Registers the disableRule tool with the FastMCP server, specifying its name, description, input schema, and execute function that delegates to WhistleClient.unselectRule and formats the response.
    server.addTool({
      name: "disableRule",
      description: "禁用规则",
      parameters: z.object({
        ruleName: z.string().describe("规则名称"),
      }),
      execute: async (args) => {
        const result = await whistleClient.unselectRule(args.ruleName);
        return formatResponse(result);
      },
    });
  • Zod schema for the disableRule tool input, requiring a 'ruleName' string parameter.
    parameters: z.object({
      ruleName: z.string().describe("规则名称"),
    }),
  • Helper function used by disableRule (and other tools) to format responses in the expected MCP content structure.
    function formatResponse(data: any) {
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(data),
          },
        ],
      };
    }
Behavior1/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. '禁用规则' implies a mutation (disabling), but it doesn't describe what happens when a rule is disabled (e.g., stops applying, remains in system), whether it's reversible (via enableRule), permission requirements, side effects, or error conditions. For a mutation tool with zero annotation coverage, this is inadequate.

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

Conciseness3/5

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

The description is extremely concise (two characters) but under-specified rather than efficiently informative. While it's front-loaded with the core action, it lacks necessary context for a mutation tool. Conciseness should not come at the cost of clarity, making this borderline adequate but with significant gaps.

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 this is a mutation tool with no annotations, no output schema, and 27 sibling tools, the description is incomplete. It doesn't explain what 'disable' entails operationally, how it differs from similar tools, or what to expect after invocation. The high sibling count increases complexity, making the minimal description insufficient for proper tool selection and 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?

The schema has 100% description coverage with 'ruleName' clearly documented as '规则名称' (rule name). The description adds no parameter information beyond what the schema provides. According to scoring rules, with high schema coverage (>80%), the baseline is 3 even with no param info in description, which applies here.

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 '禁用规则' (disable rule) is a tautology that restates the tool name 'disableRule' in Chinese. It doesn't specify what type of rule, what system it operates on, or what 'disable' means operationally. While it includes a verb+resource, it lacks specificity and doesn't distinguish from sibling tools like 'enableRule' or 'setAllRulesState' beyond the basic action.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., rule must exist), when-not-to-use scenarios (e.g., vs. deleteRule), or explicit alternatives like 'enableRule' for toggling or 'setAllRulesState' for bulk operations. With 27 sibling tools including related ones, this lack of differentiation is problematic.

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