Skip to main content
Glama

Insert text into Google Doc

insert_text

Insert text at a specific index in a Google Doc. Use indexes from get_document or find_text, with the body starting at index 1.

Instructions

Insert text at a specific index of a Google Doc. Get the index from get_document (the structure outline’s startIndex/endIndex) or find_text; the body starts at index 1 and the largest valid index is bodyEndIndex-1. To insert at the start of a paragraph use its startIndex. The inserted text takes the style of the neighbouring text, and "\n" creates new paragraphs. Inserting shifts every later index by insertedLength, so when making several index-based edits work from the end of the document backwards or re-read it with get_document. To add text at the end use append_text; to change existing wording use replace_text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe text to insert. "\n" starts a new paragraph.
indexYesA Google Docs index (UTF-16 offset). The body starts at index 1. Get exact indexes from get_document (structure) or find_text.
documentIdYesThe Google Docs document ID (the part between /d/ and /edit in the document URL). A full Google Docs URL is also accepted.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond annotations by disclosing the index-shift side effect of every insertion, that inserted text inherits neighbouring style, that "\n" creates paragraphs, and the valid index boundary (1 .. bodyEndIndex-1). These are exactly the non-obvious behaviours an agent needs for a non-idempotent mutation.

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?

Front-loaded with the core action, then progressively adds index sourcing, edge cases, and routing to siblings. Dense but every sentence carries information; the index-shift warning is the only part that could be tightened.

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 3-parameter mutation tool with no output schema, the definition covers indexing rules, side effects, style inheritance, and alternatives completely; an agent has everything needed to invoke it correctly on the first try.

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?

Schema coverage is already 100%, so the baseline is 3; the description still adds real value by stating the body starts at index 1, the largest valid index is bodyEndIndex-1, how to obtain the index, and that paragraph startIndex can be used to insert at a paragraph start.

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?

States a specific verb (insert) plus resource (text) plus precise location (at a specific index of a Google Doc), immediately distinguishing it from append_text and replace_text in the sibling list.

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?

Explicitly routes the agent: index comes from get_document or find_text, end-of-document insertion should use append_text, and rewording should use replace_text. It also gives the multi-edit workaround (work backwards or re-read).

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