renameGroup
Rename existing groups in the Whistle MCP server by specifying the current group name and the new desired name for quick and accurate proxy management.
Instructions
重命名分组
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupName | Yes | 分组的现有名称 | |
| newName | Yes | 分组的新名称 |
Implementation Reference
- src/WhistleClient.ts:239-256 (handler)The core handler function in WhistleClient that renames a group by posting form data with old and new names (prefixed with carriage return to denote groups) to the Whistle API endpoint /cgi-bin/rules/rename.async renameGroup(groupName: string, newName: string): Promise<any> { const formData = new URLSearchParams(); formData.append("clientId", `${Date.now()}-1`); formData.append("name", `\r${groupName}`); formData.append("newName", `\r${newName}`); const response = await axios.post( `${this.baseUrl}/cgi-bin/rules/rename`, formData, { headers: { "Content-Type": "application/x-www-form-urlencoded", }, } ); return response.data; }
- src/index.ts:134-137 (schema)Zod input schema for the renameGroup tool, validating groupName and newName as required strings with descriptions.parameters: z.object({ groupName: z.string().describe("分组的现有名称"), newName: z.string().describe("分组的新名称"), }),
- src/index.ts:131-145 (registration)Registers the 'renameGroup' tool using FastMCP's server.addTool, specifying name, description, input schema, and an execute handler that calls WhistleClient.renameGroup and formats the response.server.addTool({ name: "renameGroup", description: "重命名分组", parameters: z.object({ groupName: z.string().describe("分组的现有名称"), newName: z.string().describe("分组的新名称"), }), execute: async (args) => { const result = await whistleClient.renameGroup( args.groupName, args.newName ); return formatResponse(result); }, });