cloudflare-dns-mcp_list_zones
List all zones in a Cloudflare account with optional status filtering and detailed inclusion, using a structured tool for DNS and zone management.
Instructions
List all zones in the account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_details | No | ||
| status_filter | No |
Implementation Reference
- src/tools/zone-management.ts:20-41 (handler)Primary handler implementation for the 'cloudflare-dns-mcp/list_zones' tool. Fetches zones with optional status filter, optionally enriches with zone settings.handler: async (params: any) => { const { status_filter, include_details } = ListZonesInputSchema.parse(params); const query: Record<string, any> = {}; if (status_filter) query.status = status_filter; const zones = await client.get<any[]>('/zones', query); if (!include_details) return zones; // fetch settings for each zone in parallel (limit concurrency if desired) const enriched = await Promise.all( zones.map(async z => { const settings = await client.get(`/zones/${z.id}/settings`); return { content: [ { type: "text", text: JSON.stringify({ ...z, settings }, null, 2) } ] }; }), ); return enriched; },
- src/tools/zone-management.ts:10-14 (schema)Zod input schema for list_zones tool defining optional status_filter and include_details parameters.const ListZonesInputSchema = z.object({ status_filter: z.string().optional(), include_details: z.boolean().optional().default(false), });
- src/tools/zone-management.ts:19-19 (schema)Output schema for list_zones tool (array of zone objects).outputSchema: { type: 'array', items: {} } as any,
- src/index.ts:21-32 (registration)Registration in main server index.ts where zoneTools (containing list_zones) are merged into allTools. Note: overrides duplicate from dnsTools.const zoneTools = getZoneManagementTools(cfClient); const echoTools = getEchoTools(); const redirectTools = getRedirectTools(cfClient); const allTools = { ...dnsTools.tools, ...securityTools.tools, ...sslCertTools.tools, ...echoTools.tools, ...redirectTools.tools, ...zoneTools.tools, } as Record<string, any>;
- src/tools/zone-management.ts:154-154 (registration)Local registration of listZonesTool in getZoneManagementTools export.'cloudflare-dns-mcp/list_zones': listZonesTool,
- src/tools/dns-records.ts:117-120 (handler)Duplicate simpler handler in dns-records.ts (overridden by zone-management version).handler: async () => { const zones = await client.get<Array<z.infer<typeof ZoneSchema>>>('/zones'); return zones.map(z => ({ id: z.id, name: z.name, status: z.status })); },