list_dns_records
Retrieve and filter DNS records for a Cloudflare zone by type, name, or content to manage domain configurations and troubleshoot DNS issues.
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) |
Input Schema (JSON Schema)
{
"properties": {
"content": {
"description": "DNS record content to filter by",
"type": "string"
},
"name": {
"description": "DNS record name to filter by",
"type": "string"
},
"page": {
"description": "Page number for pagination",
"type": "number"
},
"per_page": {
"description": "Number of records per page (max: 100)",
"type": "number"
},
"type": {
"description": "DNS record type (A, AAAA, CNAME, TXT, MX, etc.)",
"type": "string"
},
"zone_id": {
"description": "The zone ID",
"type": "string"
}
},
"required": [
"zone_id"
],
"type": "object"
}
Implementation Reference
- The handler function that implements the list_dns_records tool. It extracts optional filter parameters from the input arguments and makes a GET request to the Cloudflare API endpoint /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 )
- src/cloudflare_mcp_server/__init__.py:110-143 (registration)Registration of the list_dns_records tool in the list_tools() handler, including its name, description, and detailed input schema defining required zone_id and optional filters.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"], }, ),
- Input schema for the list_dns_records tool, specifying the structure and descriptions for parameters including the required zone_id and optional filters like type, name, content, pagination.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"], },