cloudflare-dns-mcp_delete_page_rule
Delete a Cloudflare page rule by specifying the zone name and rule ID to manage DNS, security, or redirection settings efficiently.
Instructions
Delete a page rule by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule_id | Yes | ||
| zone_name | Yes |
Implementation Reference
- src/tools/redirects.ts:109-123 (handler)The main handler function that parses input, resolves the zone ID via Cloudflare API, deletes the page rule, and returns a confirmation in MCP format.handler: async (params: unknown) => { const { zone_name, rule_id } = DeletePageRuleInputSchema.parse(params); const zones = await client.get<Array<{ id: string; name: string }>>('/zones', { name: zone_name }); if (zones.length === 0) throw new Error(`Zone ${zone_name} not found`); const zoneId = zones[0].id; await client.delete(`/zones/${zoneId}/pagerules/${rule_id}`); return { content: [ { type: "text", text: JSON.stringify({ id: rule_id, deleted: true }, null, 2) } ] }; },
- src/tools/redirects.ts:97-107 (schema)Zod input schema definition and JSON schema for input/output, including tool name and description.const DeletePageRuleInputSchema = z.object({ zone_name: z.string(), rule_id: z.string() }); const deletePageRuleTool: Tool = { name: 'cloudflare-dns-mcp/delete_page_rule', description: 'Delete a page rule by ID', inputSchema: zodToJsonSchema(DeletePageRuleInputSchema) as any, outputSchema: { type: 'object', properties: { id: { type: 'string' }, deleted: { type: 'boolean' } }, required: ['id', 'deleted'], } as any,
- src/tools/redirects.ts:126-130 (registration)Registration of the tool in the module's tools record, returned by getRedirectTools.return { tools: { 'cloudflare-dns-mcp/list_page_rules': listPageRulesTool, 'cloudflare-dns-mcp/create_redirect': createRedirectTool, 'cloudflare-dns-mcp/delete_page_rule': deletePageRuleTool, } };
- src/index.ts:25-32 (registration)Global registration where redirect tools (including delete_page_rule) are merged into the allTools object used by the MCP server.const allTools = { ...dnsTools.tools, ...securityTools.tools, ...sslCertTools.tools, ...echoTools.tools, ...redirectTools.tools, ...zoneTools.tools, } as Record<string, any>;