Skip to main content
Glama
omd0
by omd0

translate_srt

Prepares SRT subtitle content for AI translation by parsing text, preserving timing and formatting, and returning structured data ready for translation.

Instructions

🌍 SRT TRANSLATION HELPER TOOL 🌍

🚨 CRITICAL: THIS IS A HELPER TOOL ONLY - AI DOES THE TRANSLATION! 🚨

🎯 PURPOSE: This tool helps prepare SRT content for AI translation but DOES NOT translate text itself. The AI assistant must perform the actual translation work.

📝 WHAT IT DOES:

  • Parses SRT content and extracts subtitle text for AI translation

  • Preserves timing and formatting structure

  • Returns structured data for AI to translate

  • Provides context and metadata for better translation

❌ WHAT IT DOES NOT DO:

  • ❌ Does NOT translate text automatically

  • ❌ Does NOT return translated content

  • ❌ Does NOT perform any AI translation

✅ WHAT IT RETURNS:

  • Structured SRT data with original text

  • Timing and formatting information

  • Translation context and metadata

  • Ready-to-translate format for AI

🔄 RECOMMENDED WORKFLOW:

  1. Use detect_conversations to analyze file structure

  2. Use get_next_chunk to get individual chunks

  3. Use translate_srt to prepare chunk for AI translation

  4. AI assistant translates the text content

  5. AI assistant combines results into final SRT file

💡 USAGE PATTERNS:

Prepare Full File for Translation: {"content": "full SRT content", "targetLanguage": "es", "sourceLanguage": "en"}

Prepare Individual Chunk for Translation: {"content": "chunk SRT content", "targetLanguage": "es", "sourceLanguage": "en"}

⚠️ CRITICAL INSTRUCTIONS:

  • This tool ONLY prepares content for AI translation

  • AI assistant must do the actual text translation

  • Use this to get structured data, then translate with AI

  • Return format is ready for AI processing

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesSRT file content to translate
targetLanguageYesTarget language code (e.g., es, fr, de)
sourceLanguageNoSource language code (optional, auto-detect if not provided)

Implementation Reference

  • The main execution handler for the 'translate_srt' tool. Parses SRT content using parseSRTFile and structures it into a format with subtitles, timings, and instructions for an AI to perform the actual translation. Does not translate text itself; it's a helper tool.
    private async handleTranslateSRT(args: any) {
      const { content, targetLanguage, sourceLanguage } = args;
      
      const parseResult = parseSRTFile(content);
    
      if (!parseResult.success || !parseResult.file) {
        const errorDetails = parseResult.errors?.map(e => `${e.type}: ${e.message}`).join(', ') || 'Unknown parsing error';
        throw new Error(`Failed to parse SRT file: ${errorDetails}`);
      }
    
      // Return structured data for AI translation - DO NOT TRANSLATE HERE
      const translationData = {
        originalSRT: content,
        parsedData: parseResult.file,
        translationInstructions: {
          targetLanguage: targetLanguage,
          sourceLanguage: sourceLanguage || 'auto',
          preserveTiming: true,
          preserveFormatting: true,
          context: 'subtitle_translation'
        },
        subtitles: parseResult.file.subtitles.map((subtitle, index) => ({
          index: index,
          id: `subtitle-${subtitle.index}`,
          startTime: subtitle.startTime,
          endTime: subtitle.endTime,
          originalText: subtitle.text,
          translationInstructions: {
            preserveTags: true,
            maintainTone: 'conversational',
            context: `Subtitle ${index + 1} of ${parseResult.file!.subtitles.length}`
          }
        })),
        aiTranslationTask: {
          description: `Translate ${parseResult.file!.subtitles.length} subtitles from ${sourceLanguage || 'auto'} to ${targetLanguage}`,
          instructions: [
            'Translate each subtitle text while preserving timing and formatting',
            'Maintain conversational tone and context',
            'Preserve any HTML tags or formatting',
            'Return complete translated SRT file'
          ],
          expectedOutput: 'Complete translated SRT file with all timing preserved'
        }
      };
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(translationData, null, 2),
          },
        ],
      };
    }
  • Tool registration in the MCP server's listTools handler, including the tool name, detailed description emphasizing it's a helper, and input schema defining parameters: content (required), targetLanguage (required), sourceLanguage (optional).
              {
                name: 'translate_srt',
                description: `🌍 SRT TRANSLATION HELPER TOOL 🌍
    
    🚨 CRITICAL: THIS IS A HELPER TOOL ONLY - AI DOES THE TRANSLATION! 🚨
    
    🎯 PURPOSE:
    This tool helps prepare SRT content for AI translation but DOES NOT translate text itself.
    The AI assistant must perform the actual translation work.
    
    📝 WHAT IT DOES:
    - Parses SRT content and extracts subtitle text for AI translation
    - Preserves timing and formatting structure
    - Returns structured data for AI to translate
    - Provides context and metadata for better translation
    
    ❌ WHAT IT DOES NOT DO:
    - ❌ Does NOT translate text automatically
    - ❌ Does NOT return translated content
    - ❌ Does NOT perform any AI translation
    
    ✅ WHAT IT RETURNS:
    - Structured SRT data with original text
    - Timing and formatting information
    - Translation context and metadata
    - Ready-to-translate format for AI
    
    🔄 RECOMMENDED WORKFLOW:
    1. Use detect_conversations to analyze file structure
    2. Use get_next_chunk to get individual chunks
    3. Use translate_srt to prepare chunk for AI translation
    4. AI assistant translates the text content
    5. AI assistant combines results into final SRT file
    
    💡 USAGE PATTERNS:
    
    Prepare Full File for Translation:
    {"content": "full SRT content", "targetLanguage": "es", "sourceLanguage": "en"}
    
    Prepare Individual Chunk for Translation:
    {"content": "chunk SRT content", "targetLanguage": "es", "sourceLanguage": "en"}
    
    ⚠️ CRITICAL INSTRUCTIONS:
    - This tool ONLY prepares content for AI translation
    - AI assistant must do the actual text translation
    - Use this to get structured data, then translate with AI
    - Return format is ready for AI processing`,
                inputSchema: {
                  type: 'object',
                  properties: {
                    content: {
                      type: 'string',
                      description: 'SRT file content to translate',
                    },
                    targetLanguage: {
                      type: 'string',
                      description: 'Target language code (e.g., es, fr, de)',
                    },
                    sourceLanguage: {
                      type: 'string',
                      description: 'Source language code (optional, auto-detect if not provided)',
                    },
                  },
                  required: ['content', 'targetLanguage'],
                },
              },
  • Input schema for the translate_srt tool, specifying the expected arguments structure and types.
    inputSchema: {
      type: 'object',
      properties: {
        content: {
          type: 'string',
          description: 'SRT file content to translate',
        },
        targetLanguage: {
          type: 'string',
          description: 'Target language code (e.g., es, fr, de)',
        },
        sourceLanguage: {
          type: 'string',
          description: 'Source language code (optional, auto-detect if not provided)',
        },
      },
      required: ['content', 'targetLanguage'],
    },
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes what the tool does (parses SRT, extracts text, preserves timing/formatting, returns structured data) and what it doesn't do (translate automatically). It mentions the return format and provides critical instructions about the AI's role. However, it doesn't specify error handling, performance characteristics, or authentication needs.

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

Conciseness2/5

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

The description is excessively long with redundant sections and excessive emoji/formatting. Multiple sections repeat the same core message about being a helper tool (CRITICAL, PURPOSE, WHAT IT DOES NOT DO, CRITICAL INSTRUCTIONS). While information is front-loaded, the overall structure is bloated with unnecessary visual elements and repetition that don't add value.

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

Completeness4/5

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

For a tool with no annotations and no output schema, the description does an excellent job explaining what the tool returns ('Structured SRT data with original text, Timing and formatting information, Translation context and metadata, Ready-to-translate format for AI'). It provides workflow context and distinguishes the tool's role from the AI's translation work. The main gap is lack of specific output format details that an output schema would provide.

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%, providing good baseline documentation for all three parameters. The description adds minimal parameter-specific information beyond the schema, though it does provide usage patterns that show example parameter values and clarifies that sourceLanguage is optional with auto-detection. This meets the baseline expectation when schema coverage is high.

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

Purpose5/5

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

The description explicitly states the tool's purpose: 'This tool helps prepare SRT content for AI translation but DOES NOT translate text itself.' It distinguishes itself from translation tools by emphasizing it's a helper tool that extracts and structures subtitle text for AI translation, not performing translation. The distinction from siblings like 'parse_srt' is implied through its specific translation-preparation focus.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: in a recommended workflow with 'detect_conversations' and 'get_next_chunk' as prerequisites, and 'write_srt' as a likely follow-up. It clearly states what it does NOT do (translate automatically), and includes usage patterns for full files or individual chunks. Alternatives are implied through the workflow steps and sibling tools.

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

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/omd0/srt-mcp'

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