Skip to main content
Glama

vibe_learn

Identify and categorize recurring errors with solutions to prevent repeated mistakes. Utilizes pattern recognition to enhance learning and streamline decision-making processes.

Instructions

Pattern recognition system that tracks common errors and solutions to prevent recurring issues

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory (standard categories: Complex Solution Bias, Feature Creep, Premature Implementation, Misalignment, Overtooling, Preference, Success, Other)
mistakeYesOne-sentence description of the learning entry
sessionIdNoOptional session ID for state management
solutionNoHow it was corrected (if applicable)
typeNoType of learning entry

Implementation Reference

  • Primary handler function executing the core logic of the vibe_learn tool: validates input, enforces single-sentence format, checks for duplicates, stores learning entry, and returns category summary.
    export async function vibeLearnTool(input: VibeLearnInput): Promise<VibeLearnOutput> {
      try {
        // Validate input
        if (!input.mistake) {
          throw new Error('Mistake description is required');
        }
        if (!input.category) {
          throw new Error('Mistake category is required');
        }
        const entryType: LearningType = input.type ?? 'mistake';
        if (entryType !== 'preference' && !input.solution) {
          throw new Error('Solution is required for this entry type');
        }
        
        // Enforce single-sentence constraints
        const mistake = enforceOneSentence(input.mistake);
        const solution = input.solution ? enforceOneSentence(input.solution) : undefined;
        
        // Normalize category to one of our standard categories if possible
        const category = normalizeCategory(input.category);
        
        // Check for similar mistake
        const existing = getLearningEntries()[category] || [];
        const alreadyKnown = existing.some(e => isSimilar(e.mistake, mistake));
    
        // Add mistake to log if new
        let entry: LearningEntry | undefined;
        if (!alreadyKnown) {
          entry = addLearningEntry(mistake, category, solution, entryType);
        }
        
        // Get category summaries
        const categorySummary = getLearningCategorySummary();
        
        // Find current tally for this category
        const categoryData = categorySummary.find(m => m.category === category);
        const currentTally = categoryData?.count || 1;
        
        // Get top 3 categories
        const topCategories = categorySummary.slice(0, 3);
    
        return {
          added: !alreadyKnown,
          alreadyKnown,
          currentTally,
          topCategories
        };
      } catch (error) {
        console.error('Error in vibe_learn tool:', error);
        return {
          added: false,
          alreadyKnown: false,
          currentTally: 0,
          topCategories: []
        };
      }
    }
  • TypeScript interfaces defining input and output schemas for the vibe_learn tool.
    export interface VibeLearnInput {
      mistake: string;
      category: string;
      solution?: string;
      type?: LearningType;
      sessionId?: string;
    }
    
    export interface VibeLearnOutput {
      added: boolean;
      currentTally: number;
      alreadyKnown?: boolean;
      topCategories: Array<{
        category: string;
        count: number;
        recentExample: LearningEntry;
      }>;
    }
  • src/index.ts:131-167 (registration)
    Tool registration in the MCP listTools handler, including name, description, and JSON schema for input validation.
      name: 'vibe_learn',
      description: 'Pattern recognition system that tracks common errors and solutions to prevent recurring issues',
      inputSchema: {
        type: 'object',
        properties: {
          mistake: {
            type: 'string',
            description: 'One-sentence description of the learning entry',
            examples: ['Skipped writing tests']
          },
          category: {
            type: 'string',
            description: `Category (standard categories: ${STANDARD_CATEGORIES.join(', ')})`,
            enum: STANDARD_CATEGORIES,
            examples: ['Premature Implementation']
          },
          solution: {
            type: 'string',
            description: 'How it was corrected (if applicable)',
            examples: ['Added regression tests']
          },
          type: {
            type: 'string',
            enum: ['mistake', 'preference', 'success'],
            description: 'Type of learning entry',
            examples: ['mistake']
          },
          sessionId: {
            type: 'string',
            description: 'Optional session ID for state management',
            examples: ['session-123']
          }
        },
        required: ['mistake', 'category'],
        additionalProperties: false
      }
    },
  • MCP protocol handler for callTool requests to 'vibe_learn': parses arguments, validates, calls vibeLearnTool, formats output.
    case 'vibe_learn': {
      const missing: string[] = [];
      if (!args || typeof args.mistake !== 'string') missing.push('mistake');
      if (!args || typeof args.category !== 'string') missing.push('category');
      if (missing.length) {
        const example = '{"mistake":"Skipped tests","category":"Feature Creep"}';
        const message = IS_DISCOVERY
          ? `discovery: missing [${missing.join(', ')}]; example: ${example}`
          : `Missing: ${missing.join(', ')}. Example: ${example}`;
        throw new McpError(ErrorCode.InvalidParams, message);
      }
      const input: VibeLearnInput = {
        mistake: args.mistake,
        category: args.category,
        solution: typeof args.solution === 'string' ? args.solution : undefined,
        type: ['mistake', 'preference', 'success'].includes(args.type as string)
          ? (args.type as LearningType)
          : undefined,
        sessionId: typeof args.sessionId === 'string' ? args.sessionId : undefined
      };
      const result = await vibeLearnTool(input);
      return { content: [{ type: 'text', text: formatVibeLearnOutput(result) }] };
    }
  • Supporting helper functions used by the handler: enforceOneSentence for input normalization, isSimilar for duplicate detection, normalizeCategory for standardization.
    }
    
    /**
     * Ensure text is a single sentence
     */
    function enforceOneSentence(text: string): string {

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related 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/PV-Bhat/vibe-check-mcp-server'

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