Skip to main content
Glama

agentbay_knowledge_sync

Batch sync knowledge entries from your local agent memory to AgentBay with deduplication by source and sourceKey. Full mode deprecates entries deleted locally.

Instructions

Batch sync knowledge entries from your local memory to AgentBay. Uses source+sourceKey for dedup. Mode "full" also deprecates entries deleted locally.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID
sourceYesYour agent identifier (e.g. "openclaw", "claude-code", "cursor")
entriesYesKnowledge entries to sync (max 100)
modeNo"upsert" (default) creates/updates. "full" also deprecates missing entries.

Implementation Reference

  • src/index.ts:780-807 (registration)
    Tool registration via server.tool() with name 'agentbay_knowledge_sync', description, Zod schema for inputs, and async handler function.
    server.tool(
      'agentbay_knowledge_sync',
      'Batch sync knowledge entries from your local memory to AgentBay. Uses source+sourceKey for dedup. Mode "full" also deprecates entries deleted locally.',
      {
        projectId: z.string().describe('Project ID'),
        source: z.string().describe('Your agent identifier (e.g. "openclaw", "claude-code", "cursor")'),
        entries: z.array(z.object({
          sourceKey: z.string().describe('Unique ID from your side'),
          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(),
        })).describe('Knowledge entries to sync (max 100)'),
        mode: z.enum(['upsert', 'full']).optional().describe('"upsert" (default) creates/updates. "full" also deprecates missing entries.'),
      },
      async ({ projectId, source, entries, mode }) => {
        const data = await apiPost(`/api/v1/projects/${projectId}/knowledge/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}, mode: ${data.mode}):\n`;
        text += `- Created: ${data.created}\n- Updated: ${data.updated}\n- Unchanged: ${data.unchanged}`;
        if (data.deprecated > 0) text += `\n- Deprecated: ${data.deprecated}`;
        text += `\n- Total: ${data.total}`;
        if (data.errors?.length) text += `\n\nErrors:\n${data.errors.map((e: string) => `- ${e}`).join('\n')}`;
        return { content: [{ type: 'text' as const, text }] };
      }
    );
  • Zod schema defining the input parameters: projectId (string), source (string), entries (array of objects with sourceKey, type, title, content, optional tags/filePaths/confidence), and optional mode (upsert/full).
    {
      projectId: z.string().describe('Project ID'),
      source: z.string().describe('Your agent identifier (e.g. "openclaw", "claude-code", "cursor")'),
      entries: z.array(z.object({
        sourceKey: z.string().describe('Unique ID from your side'),
        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(),
      })).describe('Knowledge entries to sync (max 100)'),
      mode: z.enum(['upsert', 'full']).optional().describe('"upsert" (default) creates/updates. "full" also deprecates missing entries.'),
    },
  • The async handler function that calls apiPost to /api/v1/projects/{projectId}/knowledge/sync, then formats a response showing created/updated/unchanged/deprecated counts and any errors.
      async ({ projectId, source, entries, mode }) => {
        const data = await apiPost(`/api/v1/projects/${projectId}/knowledge/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}, mode: ${data.mode}):\n`;
        text += `- Created: ${data.created}\n- Updated: ${data.updated}\n- Unchanged: ${data.unchanged}`;
        if (data.deprecated > 0) text += `\n- Deprecated: ${data.deprecated}`;
        text += `\n- Total: ${data.total}`;
        if (data.errors?.length) text += `\n\nErrors:\n${data.errors.map((e: string) => `- ${e}`).join('\n')}`;
        return { content: [{ type: 'text' as const, text }] };
      }
    );
Behavior3/5

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

With no annotations, the description must fully disclose behavior. It mentions dedup and deprecation, but does not clarify what 'deprecates' means (delete/inactive), rate limits, auth requirements, or the return format. Partial coverage.

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?

Two concise sentences that cover the key points: sync action, dedup, and mode behavior. No fluff, well front-loaded.

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

Completeness3/5

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

Given the tool's complexity (batch sync, multiple parameters, no output schema), the description is brief. It lacks information about return values, prerequisites, and differentiation from single-entry tools like agentbay_knowledge_record.

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 100% with descriptions, so baseline is 3. The description adds value by explaining the dedup logic via source+sourceKey, but this is a minor addition beyond the schema.

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 it batches syncs knowledge entries from local memory to AgentBay, with dedup and mode behavior. However, it does not explicitly differentiate from sibling tools like agentbay_knowledge_record or agentbay_agent_memory_sync.

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?

It explains dedup mechanism and mode behavior ('full' deprecates missing entries), which gives some guidance on when to use each mode. But it lacks explicit when-not-to-use advice or mention of alternatives among many sibling knowledge tools.

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