Skip to main content
Glama
ry-ops

Cloudflare MCP Server

by ry-ops

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

TableJSON Schema
NameRequiredDescriptionDefault
account_idNoAccount ID (uses default from config if not provided)
pageNoPage number for pagination
per_pageNoNumber of namespaces per page

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
        )
  • 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",
            },
        },
    },

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