Skip to main content
Glama

agentbay_agent_memory_record

Record an agent memory entry that persists across all projects. Use this tool to store insights, decisions, or patterns with deduplication via source and sourceRef.

Instructions

Record a memory entry that belongs to YOU (the calling agent). Agent memory follows you across all projects. Uses source+sourceRef for dedup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYes
titleYesShort title
contentYesFull content
tagsNo
filePathsNo
confidenceNo
sourceNoProvenance source (e.g. "claude-code")
sourceRefNoUnique key within the source for dedup

Implementation Reference

  • src/index.ts:389-415 (registration)
    Tool registration for 'agentbay_agent_memory_record' using server.tool() with Zod schema and async handler.
    server.tool(
      'agentbay_agent_memory_record',
      'Record a memory entry that belongs to YOU (the calling agent). Agent memory follows you across all projects. Uses source+sourceRef for dedup.',
      {
        type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']),
        title: z.string().describe('Short title'),
        content: z.string().describe('Full content'),
        tags: z.array(z.string()).optional(),
        filePaths: z.array(z.string()).optional(),
        confidence: z.number().min(0).max(1).optional(),
        source: z.string().optional().describe('Provenance source (e.g. "claude-code")'),
        sourceRef: z.string().optional().describe('Unique key within the source for dedup'),
      },
      async ({ type, title, content, tags, filePaths, confidence, source, sourceRef }) => {
        // Resolve calling agent's ID
        const meData = await apiGet('/api/v1/me');
        if (meData.error) return { content: [{ type: 'text' as const, text: `Error: ${meData.error}` }] };
        const agentId = meData.agentId;
        if (!agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key. Use agentbay_agent_register first.' }] };
    
        const data = await apiPost(`/api/v1/agents/${agentId}/memory`, {
          type, title, content, tags, filePaths, confidence, source, sourceRef,
        });
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        return { content: [{ type: 'text' as const, text: `Agent memory ${data.action}: "${data.memory?.title}"\nID: ${data.memory?.id}` }] };
      }
    );
  • Handler function that resolves the calling agent's ID via GET /api/v1/me, then posts memory to POST /api/v1/agents/{agentId}/memory.
    async ({ type, title, content, tags, filePaths, confidence, source, sourceRef }) => {
      // Resolve calling agent's ID
      const meData = await apiGet('/api/v1/me');
      if (meData.error) return { content: [{ type: 'text' as const, text: `Error: ${meData.error}` }] };
      const agentId = meData.agentId;
      if (!agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key. Use agentbay_agent_register first.' }] };
    
      const data = await apiPost(`/api/v1/agents/${agentId}/memory`, {
        type, title, content, tags, filePaths, confidence, source, sourceRef,
      });
      if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
      return { content: [{ type: 'text' as const, text: `Agent memory ${data.action}: "${data.memory?.title}"\nID: ${data.memory?.id}` }] };
    }
  • Input schema for agentbay_agent_memory_record using Zod: type enum, title, content, and optional tags, filePaths, confidence, source, sourceRef.
    {
      type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']),
      title: z.string().describe('Short title'),
      content: z.string().describe('Full content'),
      tags: z.array(z.string()).optional(),
      filePaths: z.array(z.string()).optional(),
      confidence: z.number().min(0).max(1).optional(),
      source: z.string().optional().describe('Provenance source (e.g. "claude-code")'),
      sourceRef: z.string().optional().describe('Unique key within the source for dedup'),
    },
Behavior3/5

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

No annotations exist, so the description carries full transparency burden. It discloses dedup behavior via source+sourceRef but omits idempotency details, permission needs, or whether it updates or creates exclusively.

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, behavior, and dedup mechanism. Every word adds value; no extraneous content.

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

Completeness4/5

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

Given 8 parameters, 3 required, and no output schema, the description covers core purpose and dedup. Missing details on return value and update-vs-create behavior, but sufficient for most use cases.

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 coverage is 50% (4 of 8 params described). The description adds that source+sourceRef are for dedup and notes ownership, but does not explain 'type' enum, 'tags', 'filePaths', or 'confidence' beyond schema defaults.

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 clearly states the tool records a memory entry belonging to the calling agent, with dedup via source+sourceRef. It stands out from siblings like 'agentbay_memory_store' by specifying ownership and cross-project persistence.

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

Usage Guidelines3/5

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

The description implies use for saving agent-specific memories but does not explicitly contrast with siblings like 'agentbay_knowledge_record' or 'agentbay_memory_store'. No when-not-to-use guidance is provided.

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/thomasjumper/agentbay-mcp'

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