Skip to main content
Glama

agentbay_agent_memory_sync

Batch sync memory entries to your agent memory using source and sourceKey for deduplication. Supports upsert or full mode with memory types including PATTERN, PITFALL, ARCHITECTURE, and more.

Instructions

Batch sync memory entries to your agent memory. Uses source+sourceKey for dedup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesYour agent identifier
entriesYesMemory entries to sync (max 100)
modeNo

Implementation Reference

  • src/index.ts:455-481 (registration)
    Server registration of the 'agentbay_agent_memory_sync' tool via server.tool(), which also defines its input schema (Zod) and handler function inline.
    // Tool 20: Agent Memory Sync
    server.tool(
      'agentbay_agent_memory_sync',
      'Batch sync memory entries to your agent memory. Uses source+sourceKey for dedup.',
      {
        source: z.string().describe('Your agent identifier'),
        entries: z.array(z.object({
          sourceKey: z.string(),
          type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']),
          title: z.string(),
          content: z.string(),
          tags: z.array(z.string()).optional(),
          confidence: z.number().min(0).max(1).optional(),
        })).describe('Memory entries to sync (max 100)'),
        mode: z.enum(['upsert', 'full']).optional(),
      },
      async ({ source, entries, mode }) => {
        const meData = await apiGet('/api/v1/me');
        if (!meData.agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key.' }] };
    
        const data = await apiPost(`/api/v1/agents/${meData.agentId}/memory/sync`, { source, entries, mode: mode || 'upsert' });
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        let text = `Sync complete (source: ${source}):\n- Created: ${data.created}\n- Updated: ${data.updated}\n- Unchanged: ${data.unchanged}`;
        if (data.deprecated > 0) text += `\n- Deprecated: ${data.deprecated}`;
        return { content: [{ type: 'text' as const, text }] };
      }
    );
  • Input schema for agentbay_agent_memory_sync using Zod: requires 'source' (string), 'entries' (array of objects with sourceKey, type, title, content, optional tags, confidence), and optional 'mode' (upsert/full).
    {
      source: z.string().describe('Your agent identifier'),
      entries: z.array(z.object({
        sourceKey: z.string(),
        type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']),
        title: z.string(),
        content: z.string(),
        tags: z.array(z.string()).optional(),
        confidence: z.number().min(0).max(1).optional(),
      })).describe('Memory entries to sync (max 100)'),
      mode: z.enum(['upsert', 'full']).optional(),
    },
  • Handler function for agentbay_agent_memory_sync: fetches calling agent's ID via /api/v1/me, then POSTs to /api/v1/agents/{agentId}/memory/sync with source, entries, and mode. Returns created/updated/unchanged/deprecated counts.
      async ({ source, entries, mode }) => {
        const meData = await apiGet('/api/v1/me');
        if (!meData.agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key.' }] };
    
        const data = await apiPost(`/api/v1/agents/${meData.agentId}/memory/sync`, { source, entries, mode: mode || 'upsert' });
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        let text = `Sync complete (source: ${source}):\n- Created: ${data.created}\n- Updated: ${data.updated}\n- Unchanged: ${data.unchanged}`;
        if (data.deprecated > 0) text += `\n- Deprecated: ${data.deprecated}`;
        return { content: [{ type: 'text' as const, text }] };
      }
    );
Behavior2/5

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

The description mentions dedup behavior but does not disclose whether the operation is destructive, whether it overwrites existing entries, or what permissions are needed. With no annotations, the description fails to adequately warn about side effects or safety.

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

Conciseness4/5

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

The description is concise with two sentences, front-loading the purpose. No redundant information, but it could be slightly more structured to include mode differences without adding length.

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?

The tool has no output schema, but the description does not mention return values or confirm success. Given many sibling tools, more context about distinguishing features (e.g., mode semantics) would improve completeness.

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?

The description adds value by explaining dedup via source+sourceKey, which clarifies the interplay of those parameters. However, it does not elaborate on the 'mode' parameter (upsert vs full), and schema coverage is already 67%, so the description provides moderate additional meaning.

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 tool syncs memory entries in batch and specifies the dedup mechanism using source+sourceKey. However, it does not differentiate from siblings like agentbay_agent_memory_record or agentbay_knowledge_sync, leaving ambiguity about when to use this specific tool.

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 is provided on when to use this tool versus alternatives. The description lacks context about prerequisites, constraints, or scenarios where batch sync is preferred over single-record operations.

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