Skip to main content
Glama

extract_fragments

Read-onlyIdempotent

Extract text from a .docx file as tagged fragments with unique IDs, enabling targeted changes and redlining.

Instructions

Extract text from a .docx file as tagged fragments.

Call this first to get fragment IDs, then use those IDs in ``apply_changes``.

Output format::

    <f=1>**Title**</f=1>
    <f=2>Body paragraph.</f=2>
    <table=3 rows=2 cols=3>
    <cell=3.1.1>Header</cell=3.1.1>
    <cell=3.1.2 span="2">Merged cell</cell=3.1.2>
    </table=3>

Fragment IDs:
  - Body: ``"1"``, ``"2"``, ...
  - Headers: ``"header_1.1"``, ``"header_1.2"``, ...
  - Footers: ``"footer_1.1"``, ``"footer_2.1"``, ...
  - Table cells: ``"table_id.row.col"`` (e.g., ``"3.1.2"``)

Formatting: ``**bold**``, ``_italic_``, ``__underline__``. ``

`` for paragraph breaks.

Limitations:
  - Images, nested tables, VML text boxes are skipped.
  - Pre-existing tracked changes are hard-rejected.

Args:
    document_path: Absolute path to the .docx file.

Returns:
    Tagged text string with fragment and table markup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

The description goes far beyond the annotations by detailing the exact output format, fragment ID conventions, markup syntax, and limitations (skipped elements, hard rejection of tracked changes). This provides substantial behavioral context that the annotations (readOnlyHint, idempotentHint) do not cover.

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 well-structured with clear sections (output format, fragment IDs, formatting, limitations, args, returns). It is appropriately sized given the tool's complexity, and every sentence contributes useful information without redundancy.

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?

The description is thorough: it explains the output schema, fragment ID patterns, formatting, limitations, parameters, and return value. It also places the tool in its workflow context relative to apply_changes, making it fully self-contained for the agent.

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?

With a single parameter (document_path) and 0% schema description coverage, the description compensates by explaining 'Absolute path to the .docx file,' which adds the required meaning. While not exhaustive, it fully clarifies the only parameter's purpose and type.

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 clearly states the verb+resource: 'Extract text from a .docx file as tagged fragments.' It further distinguishes the tool by explaining its role as the first step for obtaining fragment IDs to be used in apply_changes, setting it apart from sibling tools.

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 explicitly instructs 'Call this first to get fragment IDs, then use those IDs in apply_changes,' which tells the agent exactly when to use this tool. It also mentions limitations (skips images, nested tables, etc.) that imply cases where the tool is not suitable, though it does not name alternative tools for those situations.

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/sontanon/docx-mcp'

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