Skip to main content
Glama

retrieve_data

Retrieve cached data efficiently using a key from the Memory Cache Server, optimizing token usage during language model interactions for improved performance.

Instructions

Retrieve data from the cache

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesKey of the cached data to retrieve

Implementation Reference

  • The handler function for the 'retrieve_data' tool. It extracts the 'key' from the request arguments, retrieves the cached value using this.cacheManager.get(key), and returns the JSON-stringified value if found, or an error response if not.
    case 'retrieve_data': { const { key } = request.params.arguments as { key: string }; const value = this.cacheManager.get(key); if (value === undefined) { return { content: [ { type: 'text', text: `No data found for key: ${key}`, }, ], isError: true, }; } return { content: [ { type: 'text', text: JSON.stringify(value, null, 2), }, ], }; }
  • Input schema definition for the 'retrieve_data' tool, specifying an object with a required 'key' string property.
    inputSchema: { type: 'object', properties: { key: { type: 'string', description: 'Key of the cached data to retrieve', }, }, required: ['key'], },
  • src/index.ts:121-134 (registration)
    The tool registration object for 'retrieve_data' in the tools array passed to server.setTools(), including name, description, and input schema.
    { name: 'retrieve_data', description: 'Retrieve data from the cache', inputSchema: { type: 'object', properties: { key: { type: 'string', description: 'Key of the cached data to retrieve', }, }, 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/tosin2013/mcp-memory-cache-server'

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