mark_mistake
Record writing errors like logical fallacies or unclear passages to track and correct them in manuscripts, improving writing quality through systematic error documentation.
Instructions
Record a writing mistake to avoid repeating it
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | No | Path to manuscript directory (defaults to current directory) | |
| file_path | Yes | File where mistake occurred | |
| line_range | No | Line range (e.g., '45-52') | |
| mistake_type | Yes | Type of mistake | |
| description | Yes | Description of the mistake | |
| correction | No | How it should be corrected |
Implementation Reference
- src/tools/WriterToolHandlers.ts:371-393 (handler)The primary handler function for the 'mark_mistake' MCP tool. It parses the input arguments and delegates the call to WritersAid.markMistake.private async markMistake(args: Record<string, unknown>) { const filePath = args.file_path as string; const lineRange = args.line_range as string | undefined; const mistakeType = args.mistake_type as | "logical_fallacy" | "factual_error" | "poor_structure" | "inconsistency" | "unclear_writing" | "citation_error" | "redundancy" | "other"; const description = args.description as string; const correction = args.correction as string | undefined; return this.writersAid.markMistake({ filePath, lineRange, mistakeType, description, correction, }); }
- src/tools/WriterToolHandlers.ts:72-73 (registration)The dispatch case in handleTool that routes calls to the markMistake handler.case "mark_mistake": return this.markMistake(args);
- The input schema definition for the 'mark_mistake' tool, including parameters and validation rules.{ name: "mark_mistake", description: "Record a writing mistake to avoid repeating it", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" }, file_path: { type: "string", description: "File where mistake occurred" }, line_range: { type: "string", description: "Line range (e.g., '45-52')" }, mistake_type: { type: "string", enum: ["logical_fallacy", "factual_error", "poor_structure", "inconsistency", "unclear_writing", "citation_error", "redundancy", "other"], description: "Type of mistake", }, description: { type: "string", description: "Description of the mistake" }, correction: { type: "string", description: "How it should be corrected" }, }, required: ["file_path", "mistake_type", "description"], }, },
- src/WritersAid.ts:464-495 (helper)Intermediate helper in WritersAid that calls MistakeTracker.markMistake and formats the response.markMistake(options: { filePath: string; lineRange?: string; mistakeType: | "logical_fallacy" | "factual_error" | "poor_structure" | "inconsistency" | "unclear_writing" | "citation_error" | "redundancy" | "other"; description: string; correction?: string; }) { const mistake = this.mistakeTracker.markMistake({ filePath: options.filePath, lineRange: options.lineRange, mistakeType: options.mistakeType, description: options.description, correction: options.correction, timestamp: Date.now(), }); return { id: mistake.id, filePath: mistake.filePath, mistakeType: mistake.mistakeType, description: mistake.description, timestamp: new Date(mistake.timestamp).toISOString(), }; }
- src/memory/MistakeTracker.ts:57-85 (helper)Core implementation that persists the mistake to the SQLite database.markMistake(mistake: Omit<WritingMistake, "id" | "createdAt">): WritingMistake { const now = Date.now(); const newMistake: WritingMistake = { id: nanoid(), ...mistake, createdAt: now, }; this.db .prepare( `INSERT INTO writing_mistakes (id, session_id, file_path, line_range, mistake_type, description, correction, how_fixed, timestamp, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` ) .run( newMistake.id, newMistake.sessionId || null, newMistake.filePath, newMistake.lineRange || null, newMistake.mistakeType, newMistake.description, newMistake.correction || null, newMistake.howFixed || null, newMistake.timestamp, newMistake.createdAt ); return newMistake; }