Skip to main content
Glama
haasonsaas
by haasonsaas

cache_delete

Remove specific keys from the cache to manage and optimize storage. Specify the key and optional namespace for precise deletion in MCP workflows.

Instructions

Delete a key from the cache

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesCache key to delete
namespaceNoOptional namespacedefault

Implementation Reference

  • The handler function for the 'cache_delete' tool. It extracts the key and optional namespace from arguments, computes the full cache key using getCacheKey helper, deletes the entry from the cache Map if it exists, and returns a JSON response indicating success and whether the key existed.
    case "cache_delete": { const { key, namespace = "default" } = args as any; const cacheKey = getCacheKey(key, namespace); const existed = cache.delete(cacheKey); return { content: [{ type: "text", text: JSON.stringify({ success: true, key, namespace, existed }) }] }; }
  • The tool definition including name, description, and input schema for 'cache_delete'. This is part of the tools array returned by the listTools handler, effectively registering the tool.
    { name: "cache_delete", description: "Delete a key from the cache", inputSchema: { type: "object", properties: { key: { type: "string", description: "Cache key to delete" }, namespace: { type: "string", description: "Optional namespace", default: "default" } }, required: ["key"] } },
  • Helper function to generate a namespaced cache key, used by cache_get, cache_put, and cache_delete handlers.
    function getCacheKey(key: string, namespace: string = "default"): string { return `${namespace}:${key}`; }
  • Alternative implementation of the 'cache_delete' handler in index.ts (v1), without namespace support. Deletes the key from cache and returns status.
    case "cache_delete": { const { key } = args as { key: string }; const existed = cache.delete(key); return { content: [{ type: "text", text: JSON.stringify({ success: true, key, existed }) }] }; }
  • Tool schema definition for 'cache_delete' in the v1 index.ts file.
    { name: "cache_delete", description: "Delete a key from the cache", inputSchema: { type: "object", properties: { key: { type: "string", description: "Cache key to delete" } }, required: ["key"] } },

Other Tools

Related 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/haasonsaas/mcp-utility-tools'

If you have feedback or need assistance with the MCP directory API, please join our Discord server