Skip to main content
Glama
ry-ops

Cloudflare MCP Server

by ry-ops

list_zones

Retrieve all zones (domains) in your Cloudflare account with details like ID, name, status, and nameservers. Filter results by name or status.

Instructions

List all zones (domains) in the Cloudflare account. Returns zone details including ID, name, status, and nameservers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoFilter zones by name (optional)
statusNoFilter by status: active, pending, initializing, moved, deleted, deactivated (optional)
pageNoPage number for pagination (default: 1)
per_pageNoNumber of zones per page (default: 20, max: 50)

Implementation Reference

  • The _list_zones method is the handler implementation. It builds query parameters from the args dict (name, status, page, per_page) and calls _make_request to GET /zones.
    async def _list_zones(self, args: dict) -> Any:
        """List zones."""
        params = {}
        if args.get("name"):
            params["name"] = args["name"]
        if args.get("status"):
            params["status"] = args["status"]
        if args.get("page"):
            params["page"] = args["page"]
        if args.get("per_page"):
            params["per_page"] = args["per_page"]
    
        return await self._make_request("/zones", params=params)
  • The tool registration in list_tools() includes the name 'list_zones', description, and inputSchema defining optional parameters: name (string), status (string), page (number), per_page (number).
    name="list_zones",
    description=(
        "List all zones (domains) in the Cloudflare account. "
        "Returns zone details including ID, name, status, and nameservers."
    ),
    inputSchema={
        "type": "object",
        "properties": {
            "name": {
                "type": "string",
                "description": "Filter zones by name (optional)",
            },
            "status": {
                "type": "string",
                "description": "Filter by status: active, pending, initializing, moved, deleted, deactivated (optional)",
            },
            "page": {
                "type": "number",
                "description": "Page number for pagination (default: 1)",
            },
            "per_page": {
                "type": "number",
                "description": "Number of zones per page (default: 20, max: 50)",
            },
        },
    },
  • The call_tool handler dispatches to _list_zones when tool name is 'list_zones'.
    if name == "list_zones":
        result = await self._list_zones(arguments)
  • The _make_request helper method handles the HTTP request to the Cloudflare API, parsing the response and returning the result.
    async def _make_request(
        self,
        endpoint: str,
        method: str = "GET",
        data: Optional[dict] = None,
        params: Optional[dict] = None,
    ) -> Any:
        """Make a request to the Cloudflare API."""
        url = f"{CLOUDFLARE_API_BASE}{endpoint}"
        headers = {
            "Authorization": f"Bearer {self.api_token}",
            "Content-Type": "application/json",
        }
    
        try:
            response = await self.client.request(
                method=method,
                url=url,
                json=data,
                params=params,
                headers=headers,
            )
            response.raise_for_status()
            result = response.json()
    
            if not result.get("success"):
                errors = result.get("errors", [])
                raise Exception(f"Cloudflare API error: {json.dumps(errors)}")
    
            return result.get("result")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full responsibility for behavioral disclosure. It fails to mention that this is a read-only operation, any rate limits, authentication requirements, or potential side effects, offering only a minimal summary of the return fields.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-constructed sentence that packs the core purpose and returned fields efficiently, with no fluff. It could be slightly improved by front-loading the filtering capability, but it is already concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 4 optional parameters, no output schema, and no annotations, the description is incomplete. It omits important context about pagination behavior, default page size, and the scope of 'all zones' (e.g., whether it returns results across all pages).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% coverage; all four parameters are well-described in the schema. The description adds only a brief mention of response details, which does not significantly augment parameter understanding, meeting the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'list' and the resource 'zones (domains)' in a Cloudflare account, and distinguishes it from sibling tools like list_dns_records or get_zone by explicitly noting the return of zone details (ID, name, status, nameservers).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description lacks any guidance on when to use this tool versus alternatives like get_zone (for a single zone). No exclusions or preferences are indicated, leaving the agent to infer from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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