Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYes规则名称

Implementation Reference

  • 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); }, });
  • Zod input schema for the createRule tool, validating a single required 'name' parameter as a string.
    parameters: z.object({ name: 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