Skip to main content
Glama
omd0
by omd0

write_srt

Save SRT subtitle data to a file format for storage or distribution. This tool writes processed subtitle content while maintaining timing and formatting.

Instructions

Write SRT data to file format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
srtDataYesSRT data object to write

Implementation Reference

  • Handler function for the 'write_srt' tool that extracts SRT data from arguments, calls writeSRTFile to generate SRT content, and returns it as text content.
    private async handleWriteSRT(args: any) {
      const { srtData } = args;
      const srtContent = writeSRTFile(srtData);
    
      return {
        content: [
          {
            type: 'text',
            text: srtContent,
          },
        ],
      };
    }
  • Input schema definition for the 'write_srt' tool, specifying the required 'srtData' object.
    inputSchema: {
      type: 'object',
      properties: {
        srtData: {
          type: 'object',
          description: 'SRT data object to write',
        },
      },
      required: ['srtData'],
    },
  • Registration of the 'write_srt' tool in the MCP server's tool list, including name, description, and input schema.
    {
      name: 'write_srt',
      description: 'Write SRT data to file format',
      inputSchema: {
        type: 'object',
        properties: {
          srtData: {
            type: 'object',
            description: 'SRT data object to write',
          },
        },
        required: ['srtData'],
      },
    },
  • Core helper function that converts SRTFile object back to SRT string format, handling metadata and subtitles with proper formatting.
    export function writeSRTFile(srtFile: SRTFile): string {
      const lines: string[] = [];
      
      // Add metadata if present
      if (srtFile.metadata) {
        if (srtFile.metadata.title) lines.push(`TITLE: ${srtFile.metadata.title}`);
        if (srtFile.metadata.author) lines.push(`AUTHOR: ${srtFile.metadata.author}`);
        if (srtFile.metadata.description) lines.push(`DESCRIPTION: ${srtFile.metadata.description}`);
        if (lines.length > 0) lines.push(''); // Empty line after metadata
      }
      
      // Add subtitles
      for (const subtitle of srtFile.subtitles) {
        lines.push(subtitle.index.toString());
        lines.push(`${formatSRTTime(subtitle.startTime)} --> ${formatSRTTime(subtitle.endTime)}`);
        lines.push(subtitle.rawText);
        lines.push(''); // Empty line separator
      }
      
      return lines.join('\n');
    }
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 states the tool writes data, implying a mutation operation, but doesn't specify file creation behavior (e.g., overwrites existing files, requires permissions, or handles errors). For a write tool with zero annotation coverage, this leaves critical behavioral traits undisclosed.

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 with zero waste. It's front-loaded with the core action ('Write SRT data') and specifies the target ('to file format'), making it appropriately sized and easy to parse quickly.

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 tool's complexity (a write operation with nested object parameters) and lack of annotations or output schema, the description is incomplete. It doesn't cover behavioral aspects like file handling, error conditions, or output expectations, leaving significant gaps for an agent to use it correctly.

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%, with the parameter 'srtData' documented as an SRT data object to write. The description adds no additional meaning beyond this, such as format details or constraints. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't detract either.

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

Purpose3/5

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

The description states the tool writes SRT data to a file format, which is a clear verb+resource combination. However, it doesn't distinguish this from sibling tools like 'parse_srt' or 'translate_srt' that also handle SRT data, leaving the specific role ambiguous. The purpose is understandable but lacks sibling differentiation.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing parsed SRT data first), exclusions, or relationships to siblings like 'parse_srt' (which might prepare data for writing). Usage is implied from the name alone, with no explicit context.

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