Skip to main content
Glama

apply_translation

Writes translated subtitle text into the original file using cue ID mappings while preserving timing, cue order, WebVTT identifiers/settings/notes; flags empty, length, tag, or reading-speed issues.

Instructions

Step 2 of translating a subtitle: write the translated file. Timing, cue order, WebVTT identifiers/settings/notes are kept exactly; only the text changes. Every id of the file must be present in mapping (otherwise the call fails and lists the missing ids; partial=true keeps untranslated cues as they are). Warnings are reported for translations that are empty, much longer or shorter than the source, that lose or change formatting tags, or that would read too fast.

Args: path: the SAME file given to chunk_for_translation. mapping: {"1": "translated text", "2": "..."}; keys are the ids from chunk_for_translation. output: where to write (default: .translated.). overwrite: allow replacing an existing output file (default false). partial: allow a mapping that does not cover every cue. encoding: force the input text encoding. output_encoding: encoding of the written file (default utf-8; use utf-8 for non-Latin target languages).

Input Schema

NameRequiredDescriptionDefault
pathYes
outputNo
mappingYes
partialNo
encodingNo
overwriteNo
output_encodingNoutf-8

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so generously: it discloses what is preserved (timing, cue order, WebVTT identifiers/settings/notes), what changes (text only), the failure mode when ids are missing (error listing missing ids), how partial=true degrades gracefully, and the warning categories produced for suspicious translations. Overwrite defaulting to false is also surfaced.

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

Conciseness4/5

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

The purpose and constraint sentences are front-loaded and dense with useful information; the warnings sentence is long but each clause names a distinct condition. The trailing Args block repeats parameter names from the schema, which is a minor redundancy, though it earns most of its space given 0% schema coverage.

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

Completeness5/5

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

For a 7-parameter mutation tool with a nested mapping object and no annotations, the description covers prerequisites, preservation semantics, error behavior, escaping hatch (partial), and filename defaults. An output schema exists, so omitting return-value prose is appropriate and nothing an agent needs to call it correctly is missing.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate entirely, and it does — all seven parameters are explained with meaning and defaults, including the `mapping` key contract ('keys are the ids from chunk_for_translation'), the default output filename pattern, and the non-Latin target-language guidance for output_encoding. This adds substantially more than the bare schema titles.

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 opening sentence gives a specific verb and resource ('write the translated file') and anchors the tool as 'Step 2 of translating a subtitle', which pairs it explicitly with the sibling chunk_for_translation (step 1). An agent can distinguish it from read_cues, fix_common_problems, and convert without consulting the schema.

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

Usage Guidelines4/5

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

Usage context is clear: it must follow chunk_for_translation, and the `path` argument is stated to be 'the SAME file given to chunk_for_translation', which prevents a common mis-call. It does not explicitly state when *not* to use it or name a competing alternative, so it falls just short of full routing guidance.

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