list_kv_namespaces
Retrieve a paginated list of all Workers KV namespaces in your Cloudflare account for managing key-value storage.
Instructions
List all Workers KV namespaces in the account. KV is Cloudflare's key-value storage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | No | Account ID (uses default from config if not provided) | |
| page | No | Page number for pagination | |
| per_page | No | Number of namespaces per page |
Implementation Reference
- The _list_kv_namespaces method that executes the actual KV namespace listing logic. It extracts account_id, page, and per_page from args, and makes a GET request to /accounts/{account_id}/storage/kv/namespaces on the Cloudflare API.
async def _list_kv_namespaces(self, args: dict) -> Any: """List KV namespaces.""" account_id = args.get("account_id") or self.account_id if not account_id: raise ValueError("Account ID is required. Provide it in args or config.") params = {} 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"/accounts/{account_id}/storage/kv/namespaces", params=params ) - The Tool registration with input schema defining the 'list_kv_namespaces' tool, including optional properties: account_id (string), page (number), per_page (number).
Tool( name="list_kv_namespaces", description="List all Workers KV namespaces in the account. KV is Cloudflare's key-value storage.", inputSchema={ "type": "object", "properties": { "account_id": { "type": "string", "description": "Account ID (uses default from config if not provided)", }, "page": { "type": "number", "description": "Page number for pagination", }, "per_page": { "type": "number", "description": "Number of namespaces per page", }, }, }, ), - src/cloudflare_mcp_server/__init__.py:420-421 (registration)The tool dispatch/registration routing: when the tool name is 'list_kv_namespaces', it calls self._list_kv_namespaces(arguments).
elif name == "list_kv_namespaces": result = await self._list_kv_namespaces(arguments)