Skip to main content
Glama

m9k_errors

Find past solutions for error messages by searching indexed conversations, git repositories, and files to retrieve error context and resolution details.

Instructions

Find past solutions for an error message. Returns error context + how it was resolved.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorMessageYesThe error message or keywords from the error
limitNoMax results
sourceNoFilter by source type. Default: all sources.

Implementation Reference

  • Handler implementation for the m9k_errors tool. It uses a search function to find related past error context from the database and returns a snippet of the user query and assistant resolution.
      async ({ errorMessage, limit }) => {
        const results = await search(
          ctx.db,
          { query: errorMessage, limit: limit * 3 },
          ctx.searchContext,
        );
    
        // Enrich with error/solution extraction, filter by substantial assistant response
        const enriched: Array<{
          chunkId: string;
          sessionId: string;
          project: string;
          timestamp: string;
          error: string;
          solution: string;
          matchType: string;
        }> = [];
    
        for (const r of results) {
          const chunk = ctx.db
            .prepare('SELECT user_content, assistant_content FROM conv_chunks WHERE id = ?')
            .get(r.chunkId) as { user_content: string; assistant_content: string } | undefined;
    
          if (!chunk || chunk.assistant_content.length < 20) continue;
    
          enriched.push({
            chunkId: r.chunkId,
            sessionId: r.sessionId,
            project: r.project,
            timestamp: r.timestamp,
            error: chunk.user_content.slice(0, 200),
            solution: chunk.assistant_content.slice(0, 300),
            matchType: r.matchType,
          });
    
          if (enriched.length >= limit) break;
        }
    
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(enriched) }],
        };
      },
    );
  • Registration of the m9k_errors tool within the McpServer, including its description and input schema.
    server.registerTool(
      'm9k_errors',
      {
        description:
          'Find past solutions for an error message. Returns error context + how it was resolved.',
        inputSchema: {
          errorMessage: z.string().describe('The error message or keywords from the error'),
          limit: z.number().int().min(1).max(20).default(5).describe('Max results'),
          source: z
            .enum(['conversations', 'git', 'files'])
            .optional()
            .describe('Filter by source type. Default: all sources.'),
        },
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
        },
      },

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/louis49/melchizedek'

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