Skip to main content
Glama

apply_segments

Restore translated sentences into their original data module while keeping the DMC and changing only the language. It verifies the result, rejects unknown or mismatched segments, and writes only when requested.

Instructions

Put translated sentences back into the data module they were taken from. The output has the same DMC with only the language changed (issueInfo too if given). It stops with error.code "skeleton-mismatch" when the data module changed since extract_segments (skeletonHash). A segment whose id is unknown, duplicated, or whose {n} placeholders do not match is not applied and is listed in unapplied[] (the original sentence stays). The result is verified. Writes only when write is true.

Input Schema

NameRequiredDescriptionDefault
xmlNoAn existing document as an XML string (alternative to path; max 5 MB). Not for XML you wrote yourself: build new data modules with build_data_module.
pathNoFile path of the document.
writeNoWrite the result into the CSDB (the first folder of csdbDirs / S1000D_CSDB_DIR). Default false: the XML is only returned. Nothing is written when the XML is not valid against the XSD unless allowInvalid is true.
csdbDirsNoCSDB folders (in addition to S1000D_CSDB_DIR) used to resolve references, find BREX and number new objects. The FIRST folder is also where write: true writes.
languageYesTarget language written to dmIdent/language.
maxFixesNoCap on the remaining fixes listed in the response (default 50).
segmentsYesThe translated sentences, by segment id.
issueInfoNoIssue of the translated data module (default: same as the source).
overwriteNoWith write: true, replace a file of the same name. Default false: an existing file is left alone and reported as write-conflict.
allowInvalidNoWith write: true, write even when verification.schema.state is "invalid". Default false.
skeletonHashYesThe skeletonHash returned by extract_segments.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.2

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the skeleton-mismatch failure mode, the per-segment non-application rules (unknown/duplicate id, {n} placeholder mismatch) with the original sentence preserved, and that writes only occur when `write` is true. It omits overwrite-conflict and allowInvalid behaviors, which are only documented in the schema.

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?

Purpose is front-loaded in the first sentence, followed by output shape, failure mode, partial-application rules, and the write gate in a tight sequence. Every sentence carries distinct information with no filler.

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 an 11-parameter, nested-schema tool with no output schema, the description covers the critical behaviors (hash guard, unapplied[], verification, write gating). The response structure beyond `unapplied[]` and `error.code` — e.g., write-conflict reporting and remaining-fixes listing — is not described, though the schema hints at them.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: `language` is the only thing that changes in the output, `issueInfo` is optional, `skeletonHash` is the value from extract_segments, and segment `text` must preserve {n} placeholders. `maxFixes` and `csdbDirs` are left entirely to the schema.

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?

States a concrete verb and resource: putting translated sentences back into the data module they came from, and names the inverse relationship to extract_segments. An agent can immediately tell this apart from build_data_module (new content) and extract_segments (the source of the segments).

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?

The description makes the workflow clear by tying skeletonHash to extract_segments and by gating writes on `write`. It does not explicitly say 'call extract_segments first' or name when not to use it (e.g., new content belongs in build_data_module, which only appears in the schema), so usage is strongly implied rather than fully spelled out.

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