Skip to main content
Glama

extract_segments

Extracts translatable sentences from S1000D data modules, preserving stable IDs, XPath and inline placeholders, and returns a skeleton hash for applying translations later.

Instructions

Take the sentences that a person reads out of a data module so they can be translated: titles, paragraphs, step texts, warnings / cautions / notes, table cells and figure captions. Each segment has a stable id, its XPath, a context hint and the text, with inline elements (emphasis, references …) replaced by {1}, {2} placeholders that must stay in the translation. Attribute values, DMCs, ICNs, applicability expressions and ids are never offered. Also returns the skeletonHash to pass to apply_segments. The server does not translate and does not score translations.

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.
includeNoWhich kinds of sentences to return (default: all).
maxSegmentsNoCap on the number of segments returned.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.2

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the burden and discloses substantial behavior: segment structure (stable id, XPath, context hint, text), inline placeholder rules, excluded values (attribute values, DMCs, ICNs, applicability expressions, ids), and the skeletonHash return. It still does not explicitly state read-only status, file/auth constraints, or error behavior, so it is not fully complete.

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 description is front-loaded and dense, moving from purpose to segment structure to exclusions to the apply_segments linkage. Each sentence contributes, though the middle sentences are information-heavy and could be split for readability.

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?

No output schema exists, so the description must explain returns, and it does: segments with id, XPath, context hint, text, plus skeletonHash. It omits how maxSegments truncation behaves, error cases, and file access expectations, but for an extraction tool with fully documented input parameters, it is largely complete.

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 already documents all four parameters. The description mentions the content categories corresponding to the include enum and the placeholder convention, but it adds no syntax or format meaning for xml versus path or for maxSegments behavior beyond the schema. Baseline 3 is appropriate.

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 uses a specific verb and resource: 'Take the sentences that a person reads out of a data module so they can be translated.' It enumerates the exact content types returned and explicitly excludes technical values, making it distinguishable from sibling tools like build_data_module and apply_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?

It gives a clear usage context: extraction for translation, then pass the skeletonHash to apply_segments. It also states what the server does not do (translate or score). However, it does not explicitly name when not to use this tool versus alternatives such as build_data_module or convert_manual, leaving some routing to inference.

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