Skip to main content
Glama

addRuleToGroup

Add a specified rule to a designated group within the Whistle MCP Server to manage proxy configurations efficiently.

Instructions

将规则添加到分组

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupNameYes分组名称
ruleNameYes要添加的规则名称

Implementation Reference

  • The core handler function that executes the logic for adding a rule to a group by making a POST request to Whistle's `/cgi-bin/rules/move-to` endpoint with form data specifying the source rule and target group (prefixed with \r).
    async moveRuleToGroup(ruleName: string, groupName: string): Promise<any> {
      const formData = new URLSearchParams();
      formData.append("clientId", `${Date.now()}-1`);
      formData.append("from", ruleName);
      formData.append("to", `\r${groupName}`); // Adding carriage return to denote a group
      formData.append("group", "false"); // Not moving a group, but a rule
    
      const response = await axios.post(
        `${this.baseUrl}/cgi-bin/rules/move-to`,
        formData,
        {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded",
          },
        }
      );
      return response.data;
    }
  • Zod input schema defining the required parameters for the tool: groupName (target group) and ruleName (rule to add).
    parameters: z.object({
      groupName: z.string().describe("分组名称"),
      ruleName: z.string().describe("要添加的规则名称"),
    }),
  • src/index.ts:159-173 (registration)
    Registers the 'addRuleToGroup' tool in the FastMCP server, including name, description, schema, and a thin execute wrapper that calls the WhistleClient handler and formats the response.
    server.addTool({
      name: "addRuleToGroup",
      description: "将规则添加到分组",
      parameters: z.object({
        groupName: z.string().describe("分组名称"),
        ruleName: z.string().describe("要添加的规则名称"),
      }),
      execute: async (args) => {
        const result = await whistleClient.moveRuleToGroup(
          args.ruleName,
          args.groupName
        );
        return formatResponse(result);
      },
    });
  • Helper function used by the tool's execute to format the response in a standard MCP-compatible structure.
    function formatResponse(data: any) {
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(data),
          },
        ],
      };
    }
Behavior2/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 implies a mutation operation ('add'), but doesn't specify permissions needed, whether the addition is reversible, error conditions (e.g., if rule already in group), or rate limits. This is a significant gap for a tool that likely modifies data.

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 a single, efficient sentence with zero waste. It's appropriately sized for a simple tool and front-loaded with the core action, making it easy to parse quickly.

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 likely performs a mutation (adding a rule to a group), the lack of annotations and output schema means the description should do more. It doesn't explain what happens on success (e.g., confirmation message, updated group) or failure, leaving the agent with incomplete context for safe invocation.

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 description coverage is 100%, with clear descriptions for 'groupName' and 'ruleName' in the input schema. The description doesn't add any meaning beyond this (e.g., format examples, constraints), so it meets the baseline of 3 where the schema does the heavy lifting.

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

Purpose3/5

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

The description '将规则添加到分组' (Add rule to group) states a clear verb ('add') and resource ('rule to group'), which is better than a tautology. However, it doesn't specify what type of rule or group (e.g., filtering rules, security groups) or distinguish it from similar tools like 'removeRuleFromGroup' or 'addValueToGroup', making it somewhat vague.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., the group and rule must exist), exclusions, or compare it to siblings like 'createRule' or 'removeRuleFromGroup', leaving the agent without usage context.

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