createRule
Create custom rules for managing proxies on the Whistle MCP Server. Define rule names to control network requests, monitor traffic, and streamline proxy operations effectively.
Instructions
创建新规则
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | 规则名称 |
Implementation Reference
- src/WhistleClient.ts:25-32 (handler)The primary handler function that executes the createRule tool logic by sending a POST request with the rule name to Whistle's /cgi-bin/rules/add endpoint and returning the response data.async createRule(name: string): Promise<any> { const data = { name }; const response = await axios.post( `${this.baseUrl}/cgi-bin/rules/add`, data ); return response.data; }
- src/index.ts:43-53 (registration)Registers the 'createRule' MCP tool with the FastMCP server, including its description, Zod input schema, and thin execute wrapper that calls WhistleClient.createRule.server.addTool({ name: "createRule", description: "创建新规则", parameters: z.object({ name: z.string().describe("规则名称"), }), execute: async (args) => { const result = await whistleClient.createRule(args.name); return formatResponse(result); }, });
- src/index.ts:46-48 (schema)Zod input schema for the createRule tool, validating a single required 'name' parameter as a string.parameters: z.object({ name: z.string().describe("规则名称"), }),