setAllRulesState
Toggle the enabled/disabled state of all rules in Whistle MCP Server. Use this tool to globally manage rule activation with a single boolean input.
Instructions
控制所有规则的启用状态(启用/禁用)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| disabled | Yes | true表示禁用所有规则,false表示启用所有规则 |
Implementation Reference
- src/WhistleClient.ts:769-784 (handler)Core handler function that sends HTTP POST request to Whistle's /cgi-bin/rules/disable-all-rules endpoint to set all rules enabled/disabled state based on the 'disabledAllRules' parameter.async disableAllRules(disabledAllRules: boolean): Promise<any> { const formData = new URLSearchParams(); formData.append("clientId", `${Date.now()}-1`); formData.append("disabledAllRules", disabledAllRules ? "1" : "0"); const response = await axios.post( `${this.baseUrl}/cgi-bin/rules/disable-all-rules`, formData, { headers: { "Content-Type": "application/x-www-form-urlencoded", }, } ); return response.data; }
- src/index.ts:437-449 (registration)Registers the 'setAllRulesState' tool in FastMCP server, defines input schema (disabled: boolean) and execute handler that delegates to WhistleClient.disableAllRules.server.addTool({ name: "setAllRulesState", description: "控制所有规则的启用状态(启用/禁用)", parameters: z.object({ disabled: z .boolean() .describe("true表示禁用所有规则,false表示启用所有规则"), }), execute: async (args) => { const result = await whistleClient.disableAllRules(args.disabled); return formatResponse(result); }, });
- src/index.ts:440-444 (schema)Zod schema for tool input parameters.parameters: z.object({ disabled: z .boolean() .describe("true表示禁用所有规则,false表示启用所有规则"), }),