Skip to main content
Glama

agentbay_record_failure

Record a failed approach or lesson learned with project, task, and file context, and severity to build a knowledge base that prevents future agents from repeating costly mistakes.

Instructions

Record a failed approach or lesson learned so future agents avoid repeating it

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID
titleYesShort description of what failed
contentYesWhat was tried, why it failed, and what to do instead
taskIdNoRelated task ID
filePathsNoFiles involved in the failure
severityNoHow costly this failure was

Implementation Reference

  • The actual handler function for the agentbay_record_failure tool. It calls the API to record a failure as a PITFALL-type knowledge entry with tags ['failure', 'lesson-learned'] and a severity-based tag, then returns the result.
      async ({ projectId, title, content, taskId, filePaths, severity }) => {
        const tags = ['failure', 'lesson-learned'];
        if (severity) tags.push(`severity:${severity}`);
        const data = await apiPost(`/api/v1/projects/${projectId}/knowledge`, {
          type: 'PITFALL', title, content, tags, filePaths, confidence: 0.9, taskId, source: 'mcp-server',
        });
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        return { content: [{ type: 'text' as const, text: `Failure recorded: "${data.title}"\nID: ${data.id}\nThis will be shown to future agents during session_resume.` }] };
      }
    );
  • Input schema (Zod) for agentbay_record_failure, defining parameters: projectId (required), title, content, taskId, filePaths, and severity.
    {
      projectId: z.string().describe('Project ID'),
      title: z.string().describe('Short description of what failed'),
      content: z.string().describe('What was tried, why it failed, and what to do instead'),
      taskId: z.string().optional().describe('Related task ID'),
      filePaths: z.array(z.string()).optional().describe('Files involved in the failure'),
      severity: z.enum(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']).optional().describe('How costly this failure was'),
    },
  • src/index.ts:586-606 (registration)
    Registration of the tool named 'agentbay_record_failure' via server.tool() with description 'Record a failed approach or lesson learned so future agents avoid repeating it'.
    server.tool(
      'agentbay_record_failure',
      'Record a failed approach or lesson learned so future agents avoid repeating it',
      {
        projectId: z.string().describe('Project ID'),
        title: z.string().describe('Short description of what failed'),
        content: z.string().describe('What was tried, why it failed, and what to do instead'),
        taskId: z.string().optional().describe('Related task ID'),
        filePaths: z.array(z.string()).optional().describe('Files involved in the failure'),
        severity: z.enum(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']).optional().describe('How costly this failure was'),
      },
      async ({ projectId, title, content, taskId, filePaths, severity }) => {
        const tags = ['failure', 'lesson-learned'];
        if (severity) tags.push(`severity:${severity}`);
        const data = await apiPost(`/api/v1/projects/${projectId}/knowledge`, {
          type: 'PITFALL', title, content, tags, filePaths, confidence: 0.9, taskId, source: 'mcp-server',
        });
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        return { content: [{ type: 'text' as const, text: `Failure recorded: "${data.title}"\nID: ${data.id}\nThis will be shown to future agents during session_resume.` }] };
      }
    );
Behavior2/5

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

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only indicates a write operation, but lacks details on idempotency, permissions, side effects, or rate limits. The agent cannot assess the impact of invocation.

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 a single, front-loaded sentence that efficiently conveys the core action and purpose. It earns its place without redundancy, though it could be slightly expanded without becoming verbose.

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?

Given the tool has 6 parameters, including an enum, and no output schema or annotations, the description is insufficient. It does not explain return values, success/failure indications, or how to properly structure the 'content' field. Agents lack guidance for effective use.

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 description coverage is 100%, meeting baseline expectations. However, the description adds no additional meaning beyond the schema field descriptions. For example, it doesn't explain how 'severity' should be chosen or how 'filePaths' relate to the failure.

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 verb 'record', the resource 'failed approach or lesson learned', and the purpose 'so future agents avoid repeating it'. It distinguishes from sibling tools like agentbay_knowledge_record and agentbay_agent_memory_record by focusing specifically on failures.

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 usage for recording failures or lessons learned, but does not explicitly state when to use this tool versus alternatives like agentbay_knowledge_record. No guidance on prerequisites or context 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