Skip to main content
Glama
ry-ops

Cloudflare MCP Server

by ry-ops

get_zone_analytics

Retrieve analytics data for a Cloudflare zone including requests, bandwidth, threats, and pageviews within specified time ranges to monitor performance and security metrics.

Instructions

Get analytics data for a zone including requests, bandwidth, threats, and pageviews.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
zone_idYesThe zone ID
sinceNoStart time (ISO 8601 format or relative like '-1440' for last 24h)
untilNoEnd time (ISO 8601 format or relative like '-0')

Implementation Reference

  • The handler function that implements get_zone_analytics by preparing parameters and calling the Cloudflare API endpoint for zone analytics dashboard.
    async def _get_zone_analytics(self, args: dict) -> Any:
        """Get zone analytics."""
        params = {}
        if args.get("since"):
            params["since"] = args["since"]
        if args.get("until"):
            params["until"] = args["until"]
    
        return await self._make_request(
            f"/zones/{args['zone_id']}/analytics/dashboard", params=params
        )
  • Input schema for get_zone_analytics tool, specifying zone_id as required and optional since/until date parameters.
    inputSchema={
        "type": "object",
        "properties": {
            "zone_id": {"type": "string", "description": "The zone ID"},
            "since": {
                "type": "string",
                "description": "Start time (ISO 8601 format or relative like '-1440' for last 24h)",
            },
            "until": {
                "type": "string",
                "description": "End time (ISO 8601 format or relative like '-0')",
            },
        },
        "required": ["zone_id"],
    },
  • Registration/dispatch in the call_tool method that handles invocation of get_zone_analytics by calling its handler.
    elif name == "get_zone_analytics":
        result = await self._get_zone_analytics(arguments)
  • Tool registration in list_tools() method, defining the tool's metadata and schema for MCP server discovery.
    Tool(
        name="get_zone_analytics",
        description="Get analytics data for a zone including requests, bandwidth, threats, and pageviews.",
        inputSchema={
            "type": "object",
            "properties": {
                "zone_id": {"type": "string", "description": "The zone ID"},
                "since": {
                    "type": "string",
                    "description": "Start time (ISO 8601 format or relative like '-1440' for last 24h)",
                },
                "until": {
                    "type": "string",
                    "description": "End time (ISO 8601 format or relative like '-0')",
                },
            },
            "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