Skip to main content
Glama

renameRule

Renames existing rules in the Whistle MCP Server to help users organize and manage proxy configurations more effectively. Update rule names quickly for streamlined proxy server control.

Instructions

重命名规则

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
newNameYes规则的新名称
ruleNameYes规则现有名称

Implementation Reference

  • Core handler function that sends a POST request to Whistle's /cgi-bin/rules/rename endpoint to rename a rule, with validation to prevent renaming the 'default' rule.
    async renameRule(ruleName: string, newName: string): Promise<any> { // Check if trying to rename the default rule if (ruleName.toLowerCase() === "default") { throw new Error("Cannot rename the 'default' rule"); } const formData = new URLSearchParams(); formData.append("clientId", `${Date.now()}-1`); formData.append("name", ruleName); formData.append("newName", 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:69-80 (registration)
    Registers the 'renameRule' MCP tool with FastMCP, defining name, description, input schema using Zod, and execute function that delegates to WhistleClient instance.
    server.addTool({ name: "renameRule", description: "重命名规则", parameters: z.object({ ruleName: z.string().describe("规则现有名称"), newName: z.string().describe("规则的新名称"), }), execute: async (args) => { const result = await whistleClient.renameRule(args.ruleName, args.newName); return formatResponse(result); }, });
  • Zod schema defining input parameters for the renameRule tool: ruleName and newName as strings.
    parameters: z.object({ ruleName: z.string().describe("规则现有名称"), newName: z.string().describe("规则的新名称"), }),

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