Skip to main content
Glama

insert_doc_text

Destructive

Insert text at one or more positions in a Google Doc, including headers or footers, using indices from the document structure to place content accurately.

Instructions

Insert text at one or more positions in a Google Doc.

All indices are interpreted as positions in the document before any of the insertions in this call. Insertions are applied high-index-first so earlier indices are not shifted by later ones.

Use get_doc_structure to obtain the correct target indices.

Args: doc_id: The Google Doc file ID. insertions: List of insertion dicts. Required keys: index (int): document position to insert at. text (str): text to insert. "\n" creates a new paragraph. Optional keys: segment_id (str): segmentId of the header or footer to insert into (the headerId / footerId returned by create_header / create_footer). Omit to insert into the document body.

Returns: Confirmation with docId and count of insertions applied.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "doc_id": "<doc_id>",
      "insertions": "<insertions>"
    },
    "name": "insert_doc_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
doc_idYes
insertionsYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

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

With destructiveHint=true already declared, the description adds genuinely non-obvious behavior: indices are pre-call document positions and insertions are applied high-index-first so earlier indices aren't shifted. That ordering contract is the key correctness detail an agent needs. It stops short of saying what happens on out-of-range indices or whether the doc must be writable by the caller.

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?

Front-loaded purpose, then index semantics, then the args/returns breakdown — a reader can stop after sentence two and still call it correctly. Every sentence carries distinct information with no restatement of the tool name.

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 mutation tool with only two parameters and an output schema present, the description covers positioning semantics, the nested insertion dict, segment targeting, and a short return summary. Nothing material is left to inference; the return sentence is mildly redundant given the output schema but harmless.

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% — the schema only declares doc_id as a string and insertions as an untyped object array. The description compensates fully by documenting every key: index, text (with '\n' paragraph semantics), and optional segment_id mapped to headerId/footerId from create_header/create_footer, plus the omit-means-body rule.

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 opening sentence gives a precise verb and resource: 'Insert text at one or more positions in a Google Doc.' That is distinguishable from structural siblings like insert_page_break, insert_doc_table, or write_doc_content without opening any schema.

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 explicitly routes the agent to get_doc_structure to obtain correct target indices, which is a real prerequisite rather than a generic hint. It lacks an explicit when-not clause or comparison against whole-body writers like write_doc_content, so it falls short of full alternative guidance.

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

Deploy Server

Other Tools