Skip to main content
Glama

create_named_range

Destructive

Creates a named range over a Google Doc span for later API reference by name, avoiding manual index tracking as content shifts.

Instructions

Create a named range over a span of content in a Google Doc.

A named range lets you reference a section of the document by name later (e.g. with ReplaceNamedRangeContentRequest via batch_update) without tracking raw indices yourself — the Docs API automatically shifts the range's bounds as content is inserted or deleted elsewhere in the doc.

Use get_doc_structure to find start/end indices for the target span.

Args: doc_id: The Google Doc file ID. name: Name for the range. Not required to be unique; 1-256 UTF-16 code units. start_index: Start of the range (inclusive). end_index: End of the range (exclusive).

Returns: Confirmation with docId, namedRangeId, name, startIndex, endIndex.

Note: Named ranges are not visible in the Docs UI and cannot be used as internal hyperlink targets (the Link object only supports UI-created bookmarks and headings, not named ranges) — they exist purely for programmatic reference via the API.

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>",
      "name": "<name>",
      "start_index": "<start_index>",
      "end_index": "<end_index>"
    },
    "name": "create_named_range"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYes
doc_idYes
end_indexYes
start_indexYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.6

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare destructiveHint=true; the description adds substantial context beyond that: the range's bounds automatically shift as surrounding content is inserted or deleted, the range is invisible in the Docs UI, and it cannot be used as a hyperlink target. These are exactly the persistence and limitation details an agent would otherwise have to discover by trial.

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 one-line purpose, then a conceptual explanation, then a clearly delimited Args/Returns/Note structure. Slightly over-provisioned: the Returns block restates fields that an output schema already covers, so it is the one part that does not fully earn its space.

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?

A four-parameter mutation tool with an output schema, and the description still covers purpose, index discovery, index boundary semantics, downstream usage, and UI/API limitations. Nothing an agent needs to invoke it or reason about the result is missing.

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 carries the full burden and does so completely: doc_id is the file ID, name is 1-256 UTF-16 code units and need not be unique, start_index is inclusive, end_index is exclusive. The inclusive/exclusive boundary semantics in particular are not derivable from the bare integer 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?

States a specific verb and resource ("Create a named range over a span of content in a Google Doc") and goes further to define what a named range is and how it behaves. An agent can distinguish this from sibling tools like create_bookmark or style_doc_range 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?

Explicitly routes the agent to get_doc_structure for obtaining start/end indices, and names the downstream consumer (ReplaceNamedRangeContentRequest via batch_update) that justifies creating the range. It also states a negative use case (cannot back internal hyperlinks), which implicitly steers toward UI bookmarks, but no sibling is named as the alternative for that scenario.

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