Skip to main content
Glama

agentbay_knowledge_record

Record discoveries from your work: patterns, pitfalls, decisions, and insights. Store with project context, tags, and confidence to build persistent knowledge across sessions.

Instructions

Record a learning, pattern, or pitfall discovered during your work

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID
typeYes
titleYesShort title
contentYesDetailed description
tagsNo
filePathsNo
confidenceNo
sourceNo
sourceRefNo
scopeNo
taskIdNo
attemptIdNo

Implementation Reference

  • The tool handler for 'agentbay_knowledge_record'. It registers the tool via server.tool(), defines the Zod schema for inputs (projectId, type, title, content, tags, filePaths, confidence, source, sourceRef, scope, taskId, attemptId), and the async handler that POSTs to /api/v1/projects/{projectId}/knowledge and returns a formatted response including dedup detection and potential conflicts.
    server.tool(
      'agentbay_knowledge_record',
      'Record a learning, pattern, or pitfall discovered during your work',
      {
        projectId: z.string().describe('Project ID'),
        type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']),
        title: z.string().describe('Short title'),
        content: z.string().describe('Detailed description'),
        tags: z.array(z.string()).optional(),
        filePaths: z.array(z.string()).optional(),
        confidence: z.number().min(0).max(1).optional(),
        source: z.string().optional(),
        sourceRef: z.string().optional(),
        scope: z.enum(['project', 'team', 'public']).optional(),
        taskId: z.string().optional(),
        attemptId: z.string().optional(),
      },
      async ({ projectId, ...knowledgeData }) => {
        const data = await apiPost(`/api/v1/projects/${projectId}/knowledge`, knowledgeData);
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        let text = data.deduplicated
          ? `Knowledge updated (dedup): ${data.title}\nID: ${data.id}`
          : `Knowledge recorded: ${data.title}\nID: ${data.id}\nType: ${data.type}`;
        if (data.potentialConflicts?.length) {
          text += `\n\nPotential conflicts (${data.potentialConflicts.length}):`;
          for (const c of data.potentialConflicts) {
            text += `\n- "${c.title}" (confidence: ${c.confidence}) — ID: ${c.id}`;
          }
        }
        return { content: [{ type: 'text' as const, text }] };
      }
    );
  • The Zod schema for the tool's input parameters, defining types, validations, and descriptions for projectId, type, title, content, tags, filePaths, confidence, source, sourceRef, scope, taskId, and attemptId.
    {
      projectId: z.string().describe('Project ID'),
      type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']),
      title: z.string().describe('Short title'),
      content: z.string().describe('Detailed description'),
      tags: z.array(z.string()).optional(),
      filePaths: z.array(z.string()).optional(),
      confidence: z.number().min(0).max(1).optional(),
      source: z.string().optional(),
      sourceRef: z.string().optional(),
      scope: z.enum(['project', 'team', 'public']).optional(),
      taskId: z.string().optional(),
      attemptId: z.string().optional(),
    },
  • src/index.ts:331-362 (registration)
    The tool is registered using server.tool() with the name 'agentbay_knowledge_record' and a description 'Record a learning, pattern, or pitfall discovered during your work'. This is the MCP tool registration call.
    server.tool(
      'agentbay_knowledge_record',
      'Record a learning, pattern, or pitfall discovered during your work',
      {
        projectId: z.string().describe('Project ID'),
        type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']),
        title: z.string().describe('Short title'),
        content: z.string().describe('Detailed description'),
        tags: z.array(z.string()).optional(),
        filePaths: z.array(z.string()).optional(),
        confidence: z.number().min(0).max(1).optional(),
        source: z.string().optional(),
        sourceRef: z.string().optional(),
        scope: z.enum(['project', 'team', 'public']).optional(),
        taskId: z.string().optional(),
        attemptId: z.string().optional(),
      },
      async ({ projectId, ...knowledgeData }) => {
        const data = await apiPost(`/api/v1/projects/${projectId}/knowledge`, knowledgeData);
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        let text = data.deduplicated
          ? `Knowledge updated (dedup): ${data.title}\nID: ${data.id}`
          : `Knowledge recorded: ${data.title}\nID: ${data.id}\nType: ${data.type}`;
        if (data.potentialConflicts?.length) {
          text += `\n\nPotential conflicts (${data.potentialConflicts.length}):`;
          for (const c of data.potentialConflicts) {
            text += `\n- "${c.title}" (confidence: ${c.confidence}) — ID: ${c.id}`;
          }
        }
        return { content: [{ type: 'text' as const, text }] };
      }
    );
  • The apiPost helper function used by the handler to make the POST request to the AgentBay API.
    async function apiPost(path: string, body: unknown) {
      const res = await fetch(`${API_BASE}${path}`, {
        method: 'POST',
        headers: getHeaders(),
        body: JSON.stringify(body),
      });
      return res.json();
    }
Behavior1/5

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

The description does not disclose any behavioral traits like idempotency, side effects, authentication requirements, or what happens on duplicate entries. Since no annotations are provided, the description fails to compensate.

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

Conciseness3/5

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

The description is a single sentence, which is concise, but it is too brief for a tool with 12 parameters. It sacrifices necessary detail for brevity.

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

Completeness1/5

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

Given the high complexity (12 parameters, no output schema, no annotations), the description is severely incomplete. It lacks information on return values, side effects, and parameter usage.

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

Parameters1/5

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

Schema description coverage is only 25%, and the description adds no explanation for the 9 undocumented parameters (e.g., tags, confidence, scope). It adds no value beyond the schema's sparse descriptions.

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 records learnings, patterns, or pitfalls, which aligns with the tool name. However, it omits other valid types like ARCHITECTURE, DEPENDENCY, etc., and does not distinguish it from sibling tools like agentbay_knowledge_manage.

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 such as agentbay_knowledge_query or agentbay_memory_store. There is no mention of context or exclusions.

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