Skip to main content
Glama

agent_recall

Read a value from encrypted agent memory by key, or list all stored keys. Use to recall prior context or a single fact at the start of an agent loop.

Instructions

[agent] Read a value from encrypted agent memory, or list every stored key when no specific key is supplied. Use at the start of an agent loop to rehydrate prior context, or to look up a single remembered fact; prefer get_project_context for a redacted overview of secrets and get_secret for actual credential values. Read-only. With a key argument: returns JSON { ok, data: { key, value } } or a not-found error. Without key: returns a JSON listing of every stored key (no values), or 'Agent memory is empty'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyNoMemory key to read. Omit to list every stored key (without values).

Implementation Reference

  • The async handler function for the 'agent_recall' tool. If no key is provided, it lists all stored keys via listMemory(). If a key is provided, it retrieves the value via recall() and returns JSON.
    async (params) => {
      const toolBlock = enforceToolPolicy("agent_recall");
      if (toolBlock) return toolBlock;
    
      if (!params.key) {
        const entries = listMemory();
        if (entries.length === 0) return text("Agent memory is empty");
        return text(JSON.stringify(entries, null, 2));
      }
      const value = recall(params.key);
      if (value === null)
        return text(`No memory found for "${params.key}"`, true);
      return text(
        JSON.stringify({ ok: true, data: { key: params.key, value } }, null, 2),
      );
    },
  • Zod schema for the 'agent_recall' tool: an optional 'key' string parameter.
    {
      key: z
        .string()
        .optional()
        .describe(
          "Memory key to read. Omit to list every stored key (without values).",
        ),
    },
  • Registration of the 'agent_recall' tool via server.tool() inside registerAgentTools().
    server.tool(
      "agent_recall",
      [
        "[agent] Read a value from encrypted agent memory, or list every stored key when no specific key is supplied.",
        "Use at the start of an agent loop to rehydrate prior context, or to look up a single remembered fact; prefer `get_project_context` for a redacted overview of secrets and `get_secret` for actual credential values.",
        "Read-only. With a `key` argument: returns JSON `{ ok, data: { key, value } }` or a not-found error. Without `key`: returns a JSON listing of every stored key (no values), or 'Agent memory is empty'.",
      ].join(" "),
      {
        key: z
          .string()
          .optional()
          .describe(
            "Memory key to read. Omit to list every stored key (without values).",
          ),
      },
      async (params) => {
        const toolBlock = enforceToolPolicy("agent_recall");
        if (toolBlock) return toolBlock;
    
        if (!params.key) {
          const entries = listMemory();
          if (entries.length === 0) return text("Agent memory is empty");
          return text(JSON.stringify(entries, null, 2));
        }
        const value = recall(params.key);
        if (value === null)
          return text(`No memory found for "${params.key}"`, true);
        return text(
          JSON.stringify({ ok: true, data: { key: params.key, value } }, null, 2),
        );
      },
    );
  • listMemory() helper: returns all keys (with updatedAt) from the encrypted agent memory store.
    export function listMemory(): Array<{ key: string; updatedAt: string }> {
      const store = loadStore();
      return Object.entries(store.entries).map(([key, entry]) => ({
        key,
        updatedAt: entry.updatedAt,
      }));
    }
  • recall() helper: retrieves a single value by key from the encrypted agent memory store.
    export function recall(key: string): string | null {
      const store = loadStore();
      return store.entries[key]?.value ?? null;
    }
Behavior4/5

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

Declares read-only behavior and specifies return format (JSON with key-value or error) and empty memory message. Without annotations, this provides good transparency beyond the schema.

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?

Two sentences, front-loaded with purpose and usage guidelines, includes return format. Every sentence earns its place with no redundancy.

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

Completeness5/5

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

No output schema, but description covers return format for both cases. Given the tool's simplicity (one optional parameter), it is fully complete.

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

Parameters4/5

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

Schema coverage is 100% for the key parameter. Description adds nuance: omitting key lists stored keys without values, which clarifies behavior beyond the schema description.

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

Purpose5/5

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

The description states it reads from encrypted agent memory or lists keys, which is a specific verb+resource. It also distinguishes from siblings like get_project_context and get_secret, providing clear differentiation.

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

Usage Guidelines5/5

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

Explicitly advises using at start of agent loop for rehydration and prefers alternatives for secrets and credentials, offering clear when-to-use and when-not-to guidelines.

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/I4cTime/quantum_ring'

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