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
| Name | Required | Description | Default |
|---|---|---|---|
| errorMessage | Yes | The error message or keywords from the error | |
| limit | No | Max results | |
| source | No | Filter by source type. Default: all sources. |
Implementation Reference
- src/tools/specialized.ts:140-182 (handler)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) }], }; }, ); - src/tools/specialized.ts:120-139 (registration)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, }, },