list_dns_records
List and filter DNS records for a Cloudflare zone by type, name, content, and paginate results.
Instructions
List DNS records for a zone. Can filter by type, name, content, etc.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| zone_id | Yes | The zone ID | |
| type | No | DNS record type (A, AAAA, CNAME, TXT, MX, etc.) | |
| name | No | DNS record name to filter by | |
| content | No | DNS record content to filter by | |
| page | No | Page number for pagination | |
| per_page | No | Number of records per page (max: 100) |
Implementation Reference
- Handler function that executes the 'list_dns_records' tool logic. Builds query parameters from optional args (type, name, content, page, per_page) and calls the Cloudflare API GET /zones/{zone_id}/dns_records.
async def _list_dns_records(self, args: dict) -> Any: """List DNS records.""" params = {} if args.get("type"): params["type"] = args["type"] if args.get("name"): params["name"] = args["name"] if args.get("content"): params["content"] = args["content"] if args.get("page"): params["page"] = args["page"] if args.get("per_page"): params["per_page"] = args["per_page"] return await self._make_request( f"/zones/{args['zone_id']}/dns_records", params=params ) - Tool definition with input schema: requires zone_id, with optional filters for type, name, content, page, per_page.
Tool( name="list_dns_records", description="List DNS records for a zone. Can filter by type, name, content, etc.", inputSchema={ "type": "object", "properties": { "zone_id": { "type": "string", "description": "The zone ID", }, "type": { "type": "string", "description": "DNS record type (A, AAAA, CNAME, TXT, MX, etc.)", }, "name": { "type": "string", "description": "DNS record name to filter by", }, "content": { "type": "string", "description": "DNS record content to filter by", }, "page": { "type": "number", "description": "Page number for pagination", }, "per_page": { "type": "number", "description": "Number of records per page (max: 100)", }, }, "required": ["zone_id"], }, - src/cloudflare_mcp_server/__init__.py:410-411 (registration)Tool dispatch in call_tool handler: routes the 'list_dns_records' name to the _list_dns_records method.
elif name == "list_dns_records": result = await self._list_dns_records(arguments)