Skip to main content
Glama
ry-ops

Cloudflare MCP Server

by ry-ops

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

TableJSON Schema
NameRequiredDescriptionDefault
zone_idYesThe zone ID
typeNoDNS record type (A, AAAA, CNAME, TXT, MX, etc.)
nameNoDNS record name to filter by
contentNoDNS record content to filter by
pageNoPage number for pagination
per_pageNoNumber of records per page (max: 100)

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
        )
  • 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"],
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ry-ops/cloudflare-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server