Skip to main content
Glama

addValueToGroup

Add a specific value to a defined group within the Whistle MCP Server to manage and organize proxy server rules effectively.

Instructions

将值添加到分组

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupNameYes分组名称
valueNameYes要添加的值名称

Implementation Reference

  • src/index.ts:287-301 (registration)
    Registers the MCP tool 'addValueToGroup' with FastMCP, including input schema (groupName, valueName), description, and an inline execute handler that delegates to WhistleClient.moveValueToGroup and formats the response.
    server.addTool({
      name: "addValueToGroup",
      description: "将值添加到分组",
      parameters: z.object({
        groupName: z.string().describe("分组名称"),
        valueName: z.string().describe("要添加的值名称"),
      }),
      execute: async (args) => {
        const result = await whistleClient.moveValueToGroup(
          args.valueName,
          args.groupName
        );
        return formatResponse(result);
      },
    });
  • Core handler logic for adding/moving a value to a group in Whistle by sending form-encoded POST request to /cgi-bin/values/move-to with from=valueName, to=\rgroupName.
    async moveValueToGroup(name: string, groupName: string): Promise<any> {
      const formData = new URLSearchParams();
      formData.append("clientId", `${Date.now()}-1`);
      formData.append("from", name);
      formData.append("to", `\r${groupName}`); // Adding carriage return to denote a group
      formData.append("group", "false"); // Not moving a group, but a value
    
      const response = await axios.post(
        `${this.baseUrl}/cgi-bin/values/move-to`,
        formData,
        {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded",
          },
        }
      );
      return response.data;
    }
  • Zod schema defining input parameters for the tool: groupName and valueName as strings.
    parameters: z.object({
      groupName: z.string().describe("分组名称"),
      valueName: z.string().describe("要添加的值名称"),
    }),
  • Helper function used by all tools, including addValueToGroup, to format responses as MCP content array with JSON stringified data.
    function formatResponse(data: any) {
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(data),
          },
        ],
      };
    }

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