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
| 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 |
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"
- src/cloudflare_mcp_server/__init__.py:332-350 (registration)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"], }, ),
- src/cloudflare_mcp_server/__init__.py:426-427 (registration)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"], },