Skip to main content
Glama

search_similar_mistakes

Identify and avoid repeating writing errors by searching for similar mistakes in your manuscript to improve document quality.

Instructions

Search for similar mistakes to avoid repeating them

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathNoPath to manuscript directory (defaults to current directory)
descriptionYesDescription to search for similar mistakes
limitNoMaximum results

Implementation Reference

  • Tool handler that parses input arguments and delegates execution to WritersAid.searchSimilarMistakes
    private async searchSimilarMistakes(args: Record<string, unknown>) { const description = args.description as string; const limit = (args.limit as number) || 5; return this.writersAid.searchSimilarMistakes({ description, limit }); }
  • Input schema definition for the MCP tool, specifying parameters like description and optional limit
    { name: "search_similar_mistakes", description: "Search for similar mistakes to avoid repeating them", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" }, description: { type: "string", description: "Description to search for similar mistakes" }, limit: { type: "number", description: "Maximum results", default: 5 }, }, required: ["description"], }, },
  • Registration of the tool handler in the main switch dispatcher within handleTool method
    case "search_similar_mistakes": return this.searchSimilarMistakes(args);
  • Core helper function implementing similarity search via keyword extraction and SQL LIKE queries on the mistakes database
    searchSimilarMistakes( description: string, limit = 5 ): WritingMistake[] { const keywords = description .toLowerCase() .split(/\s+/) .filter((w) => w.length > 3); if (keywords.length === 0) { return []; } // Use LIKE for basic text matching let sql = `SELECT id, session_id, file_path, line_range, mistake_type, description, correction, how_fixed, timestamp, created_at FROM writing_mistakes WHERE `; const conditions = keywords.map(() => `LOWER(description) LIKE ?`); sql += conditions.join(" OR "); sql += ` ORDER BY timestamp DESC LIMIT ?`; const params: unknown[] = keywords.map((kw) => `%${kw}%`); params.push(limit); const rows = this.db.prepare(sql).all(...params) as MistakeRow[]; return rows.map((row) => this.rowToMistake(row)); }
  • Intermediate wrapper in WritersAid that invokes MistakeTracker and formats the response for the tool
    searchSimilarMistakes(options: { description: string; limit?: number }) { const mistakes = this.mistakeTracker.searchSimilarMistakes( options.description, options.limit || 5 ); return { matches: mistakes.map((m) => ({ id: m.id, filePath: m.filePath, mistakeType: m.mistakeType, description: m.description, correction: m.correction, howFixed: m.howFixed, timestamp: new Date(m.timestamp).toISOString(), })), total: mistakes.length, }; }

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/xiaolai/claude-writers-aid-mcp'

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