createGroup
Creates a new group for organizing and managing Whistle proxy rules and configurations using the Whistle MCP Server. Simplifies proxy management by enabling structured rule grouping.
Instructions
创建新分组
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | 分组名称 |
Implementation Reference
- src/WhistleClient.ts:216-231 (handler)The core handler function `createGroup` in WhistleClient class that creates a group by sending a POST request to Whistle's rules/add endpoint, prefixing the group name with a carriage return (\r) to identify it as a group.async createGroup(name: string): Promise<any> { const formData = new URLSearchParams(); formData.append("clientId", `${Date.now()}-1`); formData.append("name", `\r${name}`); const response = await axios.post( `${this.baseUrl}/cgi-bin/rules/add`, formData, { headers: { "Content-Type": "application/x-www-form-urlencoded", }, } ); return response.data; }
- src/index.ts:119-129 (registration)Registers the 'createGroup' MCP tool using FastMCP's addTool method, defining its name, description, input schema with Zod, and execute handler that delegates to WhistleClient.createGroup.server.addTool({ name: "createGroup", description: "创建新分组", parameters: z.object({ name: z.string().describe("分组名称"), }), execute: async (args) => { const result = await whistleClient.createGroup(args.name); return formatResponse(result); }, });
- src/index.ts:122-124 (schema)Zod schema for the createGroup tool input parameters, requiring a 'name' string for the group name.parameters: z.object({ name: z.string().describe("分组名称"), }),