get_zone
Retrieve detailed information about a Cloudflare zone by providing its zone ID.
Instructions
Get detailed information about a specific zone by zone ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| zone_id | Yes | The zone ID |
Implementation Reference
- The handler function _get_zone that executes the get_zone tool logic. It makes a GET request to /zones/{zone_id} to retrieve zone details.
async def _get_zone(self, args: dict) -> Any: """Get zone details.""" return await self._make_request(f"/zones/{args['zone_id']}") - Tool definition and input schema for get_zone, requiring a zone_id string parameter.
Tool( name="get_zone", description="Get detailed information about a specific zone by zone ID", inputSchema={ "type": "object", "properties": { "zone_id": { "type": "string", "description": "The zone ID", } }, "required": ["zone_id"], }, - src/cloudflare_mcp_server/__init__.py:408-409 (registration)Registration of get_zone in the call_tool handler dispatch, mapping the name to _get_zone.
elif name == "get_zone": result = await self._get_zone(arguments) - The _make_request helper function that all tool handlers use to communicate with the Cloudflare API.
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") except httpx.HTTPError as e: raise Exception(f"HTTP error occurred: {str(e)}")