Skip to main content
Glama

create_working_memory

Create temporary memory storage with expiration for AI systems to maintain continuity during tasks, using vector embeddings for content organization.

Instructions

Create a temporary working memory with expiration

Input Schema

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

Implementation Reference

  • mcp.js:656-662 (handler)
    MCP tool handler that receives the tool call arguments and calls memoryManager.createWorkingMemory() with content, embedding, and context parameters, returning the result as JSON.
    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) }] };
  • Actual implementation of createWorkingMemory method that creates a working memory entry with TTL-based expiration, inserts it into the database, and returns the created record.
    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;
      }
    }
  • mcp.js:406-435 (registration)
    Tool registration in the MCP server's tools list, defining the name, description, and input schema for create_working_memory with content, embedding, and optional context.ttl parameters.
    {
      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"]
      }
    },
  • Alternate schema definition for the create_working_memory tool, defining the same input validation structure with content, embedding (array of numbers), and optional context with TTL parameter.
      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"]
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions expiration but lacks details on permissions, rate limits, error handling, or what 'temporary' entails beyond TTL. For a creation tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise and front-loaded with a single sentence that captures the core purpose. Every word earns its place without redundancy or fluff, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a creation tool with no annotations, no output schema, and incomplete parameter documentation, the description is inadequate. It doesn't explain what the tool returns, how failures are handled, or the implications of creating a 'working memory' versus other memory types, leaving the agent with insufficient context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 67% (2 of 3 parameters described). The description adds no parameter-specific information beyond what the schema provides. With moderate coverage, the baseline is 3 as the schema does most work, but the description doesn't compensate for the undocumented 'context' parameter's semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('temporary working memory') with a key characteristic ('with expiration'). It distinguishes from siblings like 'create_memory' by specifying the temporary nature, though it doesn't explicitly contrast with all similar tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like 'create_memory' or 'create_memory_cluster'. The description implies temporary storage but doesn't specify use cases, prerequisites, or exclusions, leaving the agent to infer context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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