Skip to main content
Glama

getRules

Retrieve all rules and groupings from the Whistle MCP Server to manage proxy settings, monitor network requests, and streamline proxy server operations.

Instructions

获取所有规则&分组

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute handler for the 'getRules' MCP tool. It calls whistleClient.getRules() to fetch the rules and wraps the result using formatResponse.
    execute: async () => {
      const rules = await whistleClient.getRules();
      return formatResponse(rules);
    },
  • src/index.ts:33-41 (registration)
    Registration of the 'getRules' tool using FastMCP server's addTool method, including name, description, empty input schema, and inline handler.
    server.addTool({
      name: "getRules",
      description: "获取所有规则&分组",
      parameters: z.object({}),
      execute: async () => {
        const rules = await whistleClient.getRules();
        return formatResponse(rules);
      },
    });
  • Zod schema for input parameters of getRules tool (empty object, no parameters required).
    parameters: z.object({}),
  • Core helper method in WhistleClient that performs the HTTP GET request to Whistle's /cgi-bin/rules/list endpoint to retrieve all rules and groups.
    async getRules(): Promise<any> {
      const response = await axios.get(`${this.baseUrl}/cgi-bin/rules/list`);
      return response.data;
    }
  • Utility function used by all tools to format responses in MCP-compatible structure with JSON-stringified data.
    function formatResponse(data: any) {
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(data),
          },
        ],
      };
    }

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