Skip to main content
Glama

process_document_batch

Destructive

Apply batch edits to DOCX files: search-and-replace text, accept or reject tracked changes, reply to comments, and insert or delete table rows.

Instructions

Applies a batch of structural edits, text modifications, and review actions to a document. This is your primary tool for editing DOCX files.

CRITICAL: All changes in the batch evaluate against the ORIGINAL document state. Do not send sequential edits that depend on each other within the same batch (e.g. rename X to Y, then modify Y). Instead, apply the rename in one batch, then modify Y in a subsequent batch.

The changes parameter is a list of operations. Each item MUST have a type:

  1. 'modify': Search-and-replace text. Provide exact target_text (CRITICAL: include surrounding context if the word appears multiple times to ensure unique matching) and new_text (the replacement). new_text supports full Markdown structure: '# Heading 1' through '###### Heading 6' at the start of a line for heading styles, 'bold' and 'italic' inline formatting, and blank lines ('\n\n') to split new_text into multiple paragraphs. Multi-paragraph inserts are tracked as one logical revision. To delete text, make new_text empty. Do NOT manually write CriticMarkup tags ({++, {--, {>>). To add a comment, use the 'comment' parameter.

  2. 'accept': Finalize a tracked change. Requires target_id (e.g., 'Chg:12'). (Note: Accepting one half of a paired modify cascades to accept the other half).

  3. 'reject': Revert a tracked change. Requires target_id (e.g., 'Chg:12'). (Note: Rejecting one half cascades to reject the other half).

  4. 'reply': Reply to a comment. Requires target_id (e.g., 'Com:5') and text.

  5. 'insert_row': Insert table row. Requires target_text (anchor), position ('above'/'below'), and cells (Markdown strings).

  6. 'delete_row': Delete table row. Requires target_text inside the row to be deleted.

Always provide a realistic author_name for Tracked Changes. This name will be used for attribution in the document's tracked changes and comments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
original_docx_pathYesAbsolute path to the source file.
author_nameYesName to appear in Track Changes (e.g., 'Reviewer AI').
changesYesList of changes to apply. Each change must specify 'type'.
output_pathNoOptional output path.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations provide destructiveHint: true. The description adds valuable context: all changes evaluate against original state, accept/reject actions cascade, and author_name is required for tracked changes. It also warns against manually writing CriticMarkup tags. This goes beyond the annotation but could mention more about output behavior.

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 well-structured with sections and front-loaded with purpose and critical notes. While it is lengthy, the complexity of the tool justifies the length. Each part earns its place, though minor redundancy exists (e.g., repeated 'CRITICAL').

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?

Given the tool's complexity (multiple change types with detailed behaviors), the description covers nearly all necessary context. The schema provides 100% parameter coverage, annotations indicate destructiveness, and an output schema exists (so return values are covered). The description is complete for effective use.

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 coverage is 100%, but the description adds significant meaning: for 'modify', it emphasizes including surrounding context for unique matching and explains Markdown support; for 'accept'/'reject', it notes cascading behavior; for row operations, it provides details on anchor text. This greatly enhances understanding beyond 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?

The description clearly states the tool applies a batch of structural edits, text modifications, and review actions to DOCX files, and identifies it as the primary editing tool. It distinguishes from sibling tools like accept_all_changes and sanitize_docx by specifying batch operations.

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 states it is the primary tool for editing DOCX files and provides a critical guideline about not sending sequential edits that depend on each other within the same batch. It does not explicitly list when not to use the tool, but the context from sibling tools (e.g., read_docx for reading) implies appropriate use.

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/dealfluence/adeu'

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