Skip to main content
Glama

insert_document

Insert a full document into another at a chosen position, merging chapters into one manuscript. Reconciles styles, tables, footnotes, tracked changes; blocks unsupported content.

Instructions

Insert the ENTIRE body of source_path into target_path at one position, with full resource reconciliation: the document-assembly tool for merging chapter files into one manuscript. com_merge_documents only concatenates whole files into a new one; copy_table transplants a single table.

Position (exactly one): after_index is a body ITEM index, counting paragraphs AND tables together in document order (unlike the paragraph-only indices elsewhere); insertion lands after that item. after_anchor matches a paragraph whose FULL plain text equals the anchor; several matches refuse and list every location, so recurring heading text cannot land content at the wrong spot (prefer after_index for structural work). at_end appends after the last body item.

Carried: tables, images, charts, hyperlinks, lists (fresh numbering), footnotes/endnotes (new ids), bookmarks (remapped, collisions renamed and reported), tracked changes, equations. Styles reconcile BY NAME (the target's formatting wins on a match; unmatched styles are cloned in with dependency chains). The source's section setup is never carried; mid-content section breaks and comment references are stripped and reported. OLE objects, ActiveX, subdocuments, and altChunks refuse the whole insertion, naming the blocker; nothing is half-applied.

formatting mirrors Word's paste modes on the carried copies: 'source' (default) keeps direct formatting; 'merge' keeps bold/italic/emphasis but strips direct font/size/color/spacing/indent overrides; 'destination' strips all direct formatting except structural properties. Returns per-resource counts, style remaps, bookmark renames, and the occupied body-item range. The source file is never modified. Auto-backup: prev/anchor slots in .ks4w-backups (backup=False skips rotation only); atomic validated save. Refuses documents open in Word.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
at_endNo
backupNo
formattingNosource
after_indexNo
source_pathYes
target_pathYes
after_anchorNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations available, the description carries the full behavioral burden and does so thoroughly. It discloses that the source file is never modified, that Word-open documents are refused, that problematic objects like OLE or ActiveX abort the whole insertion without half-applying, that styles reconcile by name, and that backup slots are rotated. This far exceeds typical disclosure.

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 long, but it is dense and purposefully structured: purpose first, then positional choice, then carried/reconciled content, formatting behavior, return values, and safety guarantees. Every sentence adds operationally relevant information with no filler, and the most important selection guidance is front-loaded.

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 complex merge tool with no annotations and an output schema to handle return details, the description is exceptionally complete. It covers what is carried, what is stripped, what causes refusals, formatting modes, backup behavior, positional semantics, and safety guarantees. An agent has enough context to invoke the tool correctly and predict its side effects.

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 explain all parameters itself. It does this comprehensively: after_index is defined as a body item index counting paragraphs and tables, after_anchor requires a full plain-text match and refuses ambiguous multiple matches, at_end is appending after the last body item, formatting modes are spelled out, and backup behavior is clarified. Nothing is left to guesswork.

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 opens with a specific verb and resource: inserting the ENTIRE body of source_path into target_path, and frames the tool as the document-assembly tool for merging chapter files. It explicitly distinguishes itself from com_merge_documents and copy_table, so an agent can pick it correctly among siblings.

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

Usage Guidelines5/5

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

The description states when this tool is appropriate (merging chapter files into one manuscript) and names alternatives with their limitations: com_merge_documents only concatenates whole files, while copy_table transplants a single table. It also gives concrete positional guidance, e.g., prefer after_index for structural work and avoid after_anchor for recurring heading text.

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/nometalalchemist/KitchenSink4Word'

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