Skip to main content
Glama
ry-ops

Cloudflare MCP Server

by ry-ops

delete_kv_value

Remove a specific key from Cloudflare Workers KV storage to manage stored data and maintain namespace organization.

Instructions

Delete a key from Workers KV storage

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "account_id": { "description": "Account ID (uses default from config if not provided)", "type": "string" }, "key": { "description": "The key to delete", "type": "string" }, "namespace_id": { "description": "The KV namespace ID", "type": "string" } }, "required": [ "namespace_id", "key" ], "type": "object" }

Implementation Reference

  • The main handler function that executes the delete_kv_value tool by constructing the Cloudflare KV delete API URL and sending a DELETE request using httpx.
    async def _delete_kv_value(self, args: dict) -> str: """Delete 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.delete(url, headers=headers) response.raise_for_status() return "KV value deleted successfully"
  • Tool registration in list_tools(), defining the name, description, and input schema for delete_kv_value.
    Tool( name="delete_kv_value", description="Delete a key from Workers KV storage", 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 delete"}, }, "required": ["namespace_id", "key"], }, ),
  • Dispatch logic in call_tool() that routes the tool call to the _delete_kv_value handler.
    elif name == "delete_kv_value": result = await self._delete_kv_value(arguments)
  • Input schema defining the parameters for the delete_kv_value tool: namespace_id and key required, account_id optional.
    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 delete"}, }, "required": ["namespace_id", "key"], },

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