list_kv_namespaces
Retrieve all Workers KV namespaces in your Cloudflare account to manage key-value storage resources and organize data across your applications.
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 |
Input Schema (JSON Schema)
{
"properties": {
"account_id": {
"description": "Account ID (uses default from config if not provided)",
"type": "string"
},
"page": {
"description": "Page number for pagination",
"type": "number"
},
"per_page": {
"description": "Number of namespaces per page",
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- The handler function that implements the logic for listing KV namespaces by calling the Cloudflare API with optional pagination parameters.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 )
- src/cloudflare_mcp_server/__init__.py:264-284 (registration)The tool is registered in the list_tools() method by defining the Tool object including name, description, and schema.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", }, }, }, ),
- The input schema defining the parameters for the list_kv_namespaces tool: optional account_id, page, and per_page.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", }, }, },