Skip to main content
Glama

create_working_memory

Generate a temporary working memory with a specified time-to-live, enabling AI systems to store and manage content and embeddings for short-term task continuity and context retention.

Instructions

Create a temporary working memory with expiration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesContent of the working memory
contextNo
embeddingYesVector embedding for the content

Implementation Reference

  • mcp.js:656-662 (handler)
    MCP server tool handler for 'create_working_memory': extracts arguments and calls memoryManager.createWorkingMemory, returns JSON stringified result.
    case "create_working_memory": const workingMemory = await memoryManager.createWorkingMemory( args.content, args.embedding, args.context || {} ); return { content: [{ type: "text", text: JSON.stringify(workingMemory, null, 2) }] };
  • Tool schema definition including name, description, and inputSchema for validation in ListToolsRequest response.
    { name: "create_working_memory", description: "Create a temporary working memory with expiration", inputSchema: { type: "object", properties: { content: { type: "string", description: "Content of the working memory" }, embedding: { type: "array", items: { type: "number" }, description: "Vector embedding for the content" }, context: { type: "object", properties: { ttl: { type: "integer", description: "Time to live in seconds", default: 3600 } }, default: {} } }, required: ["content", "embedding"] }
  • Core implementation: creates a working memory record in the database with content, embedding, and computed expiry time based on TTL.
    async createWorkingMemory(content, embedding, context = {}) { try { const ttl = context.ttl || 3600; // Default 1 hour const expirationTime = new Date(Date.now() + ttl * 1000); const [workingMemory] = await this.db .insert(schema.workingMemory) .values({ content, embedding: embedding, expiry: expirationTime }) .returning(); return workingMemory; } catch (error) { console.error('Error creating working memory:', error); throw error; }
  • Exported tool schema definition in memoryTools array (identical to mcp.js, possibly for reference or other uses).
    { name: "create_working_memory", description: "Create a temporary working memory with expiration", inputSchema: { type: "object", properties: { content: { type: "string", description: "Content of the working memory" }, embedding: { type: "array", items: { type: "number" }, description: "Vector embedding for the content" }, context: { type: "object", properties: { ttl: { type: "integer", description: "Time to live in seconds", default: 3600 } }, default: {} } }, required: ["content", "embedding"] }

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/QuixiAI/agi-mcp-server'

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