deleteRule
Remove specific rules from the Whistle MCP Server to streamline proxy management. Input the rule name to delete it, ensuring efficient control over network request configurations.
Instructions
删除规则
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ruleName | Yes | 要删除的规则名称 |
Implementation Reference
- src/index.ts:82-92 (registration)Registers the 'deleteRule' MCP tool with name, description, input schema using Zod, and handler function.server.addTool({ name: "deleteRule", description: "删除规则", parameters: z.object({ ruleName: z.string().describe("要删除的规则名称"), }), execute: async (args) => { const result = await whistleClient.deleteRule(args.ruleName); return formatResponse(result); }, });
- src/index.ts:85-87 (schema)Input schema definition for the deleteRule tool: requires 'ruleName' as a string.parameters: z.object({ ruleName: z.string().describe("要删除的规则名称"), }),
- src/index.ts:88-91 (handler)The execute handler for the deleteRule tool, which invokes WhistleClient.deleteRule and formats the response.execute: async (args) => { const result = await whistleClient.deleteRule(args.ruleName); return formatResponse(result); },
- src/WhistleClient.ts:99-113 (helper)Core helper function in WhistleClient that performs the HTTP POST request to delete the rule via Whistle API.async deleteRule(ruleName: string): Promise<any> { const formData = new URLSearchParams(); formData.append("list[]", ruleName); const response = await axios.post( `${this.baseUrl}/cgi-bin/rules/remove`, formData, { headers: { "Content-Type": "application/x-www-form-urlencoded", }, } ); return response.data; }