Skip to main content
Glama
MushroomFleet

TranscriptionTools MCP Server

repair_text

Analyzes and repairs errors in transcribed text to improve accuracy, ensuring natural formatting and contextual corrections. Accepts text content or file paths for processing.

Instructions

Analyzes and repairs transcription errors with greater than 90% confidence

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_textYesText content or path to file containing transcribed text
is_file_pathNoWhether input_text is a file path

Implementation Reference

  • Main handler function that executes the repair_text tool logic: resolves input, applies simulated NLP corrections for common errors, logs process, writes output file, and returns path.
    export async function repairText(params: RepairTextParams): Promise<{ output_file: string }> {
      try {
        const { input_text, is_file_path = false } = params;
        
        // Resolve content (either direct text or from file)
        const textContent = await FileHandler.resolveTextContent(input_text, is_file_path);
        
        // Create a session ID and logger
        const logger = new Logger();
        const sessionId = logger.getSessionId();
        
        // This would be a more complex NLP processing in a real implementation
        // Here we just simulate the repair process with some example corrections
        
        // Split text into words for processing
        const words = textContent.split(/\s+/);
        const totalWords = words.length;
        
        // Simulate finding and correcting errors
        const corrections: Array<{
          original: string;
          corrected: string;
          confidence: number;
          context: string;
          evidence: string[];
        }> = [];
        
        // In a real implementation, this would use NLP models to identify errors
        // Here we're just simulating with some basic replacements
        const commonErrors = [
          { pattern: /recieve/gi, replacement: 'receive', confidence: 95 },
          { pattern: /defiantly/gi, replacement: 'definitely', confidence: 93 },
          { pattern: /irregardless/gi, replacement: 'regardless', confidence: 91 },
          { pattern: /alot/gi, replacement: 'a lot', confidence: 97 },
          { pattern: /seperate/gi, replacement: 'separate', confidence: 94 }
        ];
        
        // Process the text
        let repairedText = textContent;
        let totalConfidence = 0;
        
        for (const error of commonErrors) {
          if (error.pattern.test(repairedText)) {
            // Find all instances of this error
            const matches = repairedText.match(error.pattern) || [];
            
            for (const match of matches) {
              // Get some context around the error (simulated)
              const contextIndex = repairedText.indexOf(match);
              const start = Math.max(0, contextIndex - 20);
              const end = Math.min(repairedText.length, contextIndex + match.length + 20);
              const context = repairedText.substring(start, end);
              
              corrections.push({
                original: match,
                corrected: match.replace(error.pattern, error.replacement),
                confidence: error.confidence,
                context,
                evidence: [
                  'Pattern recognition',
                  'Dictionary verification',
                  'Semantic analysis'
                ]
              });
              
              totalConfidence += error.confidence;
            }
            
            // Apply the correction to the full text
            repairedText = repairedText.replace(error.pattern, error.replacement);
          }
        }
        
        // Calculate statistics
        const correctionsMade = corrections.length;
        const averageConfidence = correctionsMade > 0 
          ? Math.round(totalConfidence / correctionsMade) 
          : 0;
        
        // Write the repaired text to a file
        const outputFile = 'repaired.txt';
        await FileHandler.writeTextFile(outputFile, repairedText);
        
        // Log the repair process
        const stats = {
          totalWords,
          correctionsMade,
          averageConfidence
        };
        
        const logPath = await logger.logRepairProcess(
          is_file_path ? input_text : 'direct_input',
          corrections,
          stats
        );
        
        return { output_file: outputFile };
      } catch (error) {
        throw new Error(`Repair process failed: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • TypeScript interface defining input parameters for the repair_text tool.
    /**
     * Interface for the repair_text function parameters
     */
    export interface RepairTextParams {
      input_text: string;
      is_file_path?: boolean;
    }
  • src/index.ts:56-72 (registration)
    Tool registration in listTools handler, including name, description, and input schema.
    name: 'repair_text',
    description: 'Analyzes and repairs transcription errors with greater than 90% confidence',
    inputSchema: {
      type: 'object',
      properties: {
        input_text: {
          type: 'string',
          description: 'Text content or path to file containing transcribed text'
        },
        is_file_path: {
          type: 'boolean',
          description: 'Whether input_text is a file path',
          default: false
        }
      },
      required: ['input_text']
    }
  • src/index.ts:155-168 (registration)
    Dispatch handler in callToolRequest that routes 'repair_text' calls to the repairText function.
    case 'repair_text':
      // Validate required parameters
      if (!args || typeof args.input_text !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: input_text');
      }
      const repairResult = await repairText(args as unknown as RepairTextParams);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(repairResult, null, 2)
          }
        ]
      };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool 'Analyzes and repairs' and includes a confidence metric ('greater than 90% confidence'), which hints at reliability but lacks details on error handling, side effects, permissions, rate limits, or response format. For a tool with no annotations, this is insufficient to understand its operational behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality ('Analyzes and repairs transcription errors') and adds a useful performance detail ('with greater than 90% confidence'). There is no wasted language or redundancy, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a repair tool with no annotations and no output schema, the description is incomplete. It lacks information on what the tool returns (e.g., repaired text, error logs), how it handles failures, or any behavioral constraints. The confidence metric is helpful but insufficient for full contextual understanding, especially for a tool that likely involves mutation or analysis.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the two parameters ('input_text' and 'is_file_path'). The description adds no parameter-specific information beyond what the schema provides, such as examples of text content or file paths. With high schema coverage, the baseline score is 3, as the description does not compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Analyzes and repairs') and resource ('transcription errors'), and includes a performance metric ('greater than 90% confidence'). It distinguishes from sibling tools like 'format_transcript' (which likely formats rather than repairs) and 'summary_text' (which summarizes rather than repairs), though it doesn't explicitly mention these distinctions. The purpose is not vague or tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention when to choose 'repair_text' over sibling tools like 'format_transcript' or 'get_repair_log', nor does it specify prerequisites, exclusions, or contextual cues for usage. The agent must infer usage based on the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/MushroomFleet/TranscriptionTools-MCP'

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