Skip to main content
Glama
ry-ops

Cloudflare MCP Server

by ry-ops

read_kv_value

Retrieve stored values from Cloudflare Workers KV by providing a namespace ID and key. Returns the associated value.

Instructions

Read a value from Workers KV storage by key. Returns the stored value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idNoAccount ID (uses default from config if not provided)
namespace_idYesThe KV namespace ID
keyYesThe key to read

Implementation Reference

  • Tool schema definition for 'read_kv_value' tool, specifying input parameters: account_id (optional), namespace_id (required), and key (required).
    Tool(
        name="read_kv_value",
        description="Read a value from Workers KV storage by key. Returns the stored value.",
        inputSchema={
            "type": "object",
            "properties": {
                "account_id": {
                    "type": "string",
                    "description": "Account ID (uses default from config if not provided)",
                },
                "namespace_id": {
                    "type": "string",
                    "description": "The KV namespace ID",
                },
                "key": {"type": "string", "description": "The key to read"},
            },
            "required": ["namespace_id", "key"],
        },
  • Registration of the 'read_kv_value' tool in the call_tool handler, routing to _read_kv_value method.
    elif name == "read_kv_value":
        result = await self._read_kv_value(arguments)
  • Handler function that executes the 'read_kv_value' tool logic: makes a GET request to the Cloudflare API endpoint for reading a KV value, returns the raw response text.
    async def _read_kv_value(self, args: dict) -> str:
        """Read KV value."""
        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.")
    
        url = f"{CLOUDFLARE_API_BASE}/accounts/{account_id}/storage/kv/namespaces/{args['namespace_id']}/values/{args['key']}"
        headers = {"Authorization": f"Bearer {self.api_token}"}
    
        response = await self.client.get(url, headers=headers)
        response.raise_for_status()
    
        return response.text
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavioral traits. It only states it reads and returns a value, but does not specify behavior for missing keys (null vs error), repeatability, permissions, or any side effects. This is insufficient for reliable agent invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences with no superfluous content. However, it could incorporate a bit more detail (e.g., key existence handling) without harming conciseness. Still, it is efficiently front-loaded and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read tool without an output schema, the description should clarify the return format or error cases. It only says 'Returns the stored value,' which is vague. An agent lacks information on what happens if the key does not exist or if the namespace is invalid, making the tool incomplete for autonomous use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage with clear descriptions (e.g., account_id defaults to config, namespace_id and key are required). The description adds only 'by key' which is already implied. Since schema coverage is high, baseline 3 is appropriate; no extra nuance is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Read a value'), the resource ('Workers KV storage by key'), and the return behavior ('Returns the stored value'). This unambiguously differentiates it from sibling tools like write_kv_value or delete_kv_value.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No usage context or alternatives are mentioned. An agent receives no guidance on when to use this tool over, say, list_kv_keys, or what prerequisites are needed (e.g., does the key need to exist?). This omission forces the agent to rely on trial and error.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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