delete_kv_value
Remove a key-value pair from Cloudflare Workers KV storage by specifying the namespace and key.
Instructions
Delete a key from Workers KV storage
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | No | Account ID (uses default from config if not provided) | |
| namespace_id | Yes | The KV namespace ID | |
| key | Yes | The key to delete |
Implementation Reference
- The actual handler function _delete_kv_value that executes the delete logic: extracts account_id, builds the API URL, and performs a DELETE request to the Cloudflare KV API.
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" - The Tool definition and inputSchema for delete_kv_value, specifying required parameters: namespace_id and key, with optional account_id.
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"], }, ), - src/cloudflare_mcp_server/__init__.py:426-427 (registration)The call_tool handler routing: matches the name 'delete_kv_value' and dispatches to the _delete_kv_value method.
elif name == "delete_kv_value": result = await self._delete_kv_value(arguments)