toggleHttp2
Enable or disable HTTP/2 protocol for Whistle proxy servers using the Whistle MCP Server. Manage HTTP/2 settings directly for optimized network performance.
Instructions
启用或禁用HTTP/2
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| enabled | Yes | 是否启用HTTP/2 |
Implementation Reference
- src/WhistleClient.ts:748-763 (handler)Core handler function that toggles HTTP/2 by posting form data to Whistle's /cgi-bin/enable-http2 endpoint.async toggleHttp2(enabled: boolean): Promise<any> { const formData = new URLSearchParams(); formData.append("clientId", `${Date.now()}-${Math.floor(Math.random() * 100)}`); formData.append("enableHttp2", enabled ? "1" : "0"); const response = await axios.post( `${this.baseUrl}/cgi-bin/enable-http2`, formData, { headers: { "Content-Type": "application/x-www-form-urlencoded", }, } ); return response.data; }
- src/index.ts:362-372 (registration)Registers the MCP tool 'toggleHttp2' with name, description, Zod input schema, and execute handler that calls WhistleClient.toggleHttp2 and formats response.server.addTool({ name: "toggleHttp2", description: "启用或禁用HTTP/2", parameters: z.object({ enabled: z.boolean().describe("是否启用HTTP/2"), }), execute: async (args) => { const result = await whistleClient.toggleHttp2(args.enabled); return formatResponse(result); }, });
- src/index.ts:365-367 (schema)Zod schema defining the input parameter 'enabled' as boolean for the toggleHttp2 tool.parameters: z.object({ enabled: z.boolean().describe("是否启用HTTP/2"), }),