Skip to main content
Glama
xiaolai
by xiaolai

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
NameRequiredDescriptionDefault
project_pathNoPath to manuscript directory (defaults to current directory)
file_pathYesFile where mistake occurred
line_rangeNoLine range (e.g., '45-52')
mistake_typeYesType of mistake
descriptionYesDescription of the mistake
correctionNoHow it should be corrected

Implementation Reference

  • 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,
      });
    }
  • 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"],
      },
    },
  • 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(),
      };
    }
  • 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;
    }

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