Skip to main content
Glama

Insert hyperlink in Google Doc

insert_link
Idempotent

Turns existing text in a Google Doc's index range into a hyperlink to an HTTP, HTTPS, or mailto URL, replacing any existing link. Use get_document or find_text to get indexes.

Instructions

Turn the existing text in the index range [startIndex, endIndex) of a Google Doc into a hyperlink to url (http, https and mailto links only). The text itself is not changed and any link already on it is replaced. To link new text, first add it with insert_text or append_text (both return the new text’s range), then link that range. Get indexes from get_document or find_text. Does not change indexes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesLink target, e.g. "https://example.com" or "mailto:someone@example.com".
endIndexYesEnd of the range (exclusive); must be greater than startIndex.
documentIdYesThe Google Docs document ID (the part between /d/ and /edit in the document URL). A full Google Docs URL is also accepted.
startIndexYesStart of the range (inclusive). Get exact indexes from get_document or find_text.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations cover the safety profile (readOnlyHint=false, destructiveHint=false, idempotentHint=true), and the description adds real context beyond them: only http/https/mailto schemes are accepted, the underlying text is unchanged, any existing link is replaced, and indexes are preserved after the operation.

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-loads the core operation, then follows with the replacement semantics, the new-text workflow, and the index sources. Every sentence carries distinct information with no filler.

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 4-required-param mutation tool with no output schema, the description supplies the behavioral facts an agent needs: accepted schemes, replacement behavior, and the index-preservation guarantee that tells the caller no reindexing is required.

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 100%, so the baseline is 3, but the description adds meaning beyond the schema: it explains the half-open range notation [startIndex, endIndex), the scheme restriction on url, and the invariant that indexes do not shift. This is more than the schema's field-level notes provide.

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 precise verb+resource: turn existing text in an index range of a Google Doc into a hyperlink. It names the exact range syntax and the url target, making it clearly distinguishable from siblings like format_text or insert_text.

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: to link new text, first add it with insert_text or append_text (noting both return the range), then link that range. It also names get_document and find_text as the sources of valid indexes, so when-to-use and prerequisites are fully covered.

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