Skip to main content
Glama

Style text in a doc

set_style

Apply formatting like bold, color, font size, or alignment to existing text in a Google Doc without rewriting it. Target a selected snippet or the entire document to update styles directly.

Instructions

Apply styling to existing text in place (no content change), the way you select text in Docs and apply formatting. Pick ONE target: from (+ optional to) to style a selection — from the start of the unique from snippet to the end of the unique to snippet (omit to to style just from); or whole_document: true to style the entire doc/tab (e.g. one font throughout, without per-paragraph calls). Styles: bold/italic/underline/strikethrough, color (hex), fontSize (pt), fontFamily, link, paragraph alignment, and paragraph spacing (spaceBefore/spaceAfter in pt, lineSpacing %). Use get_style first to read current spacing/fonts. Prefer this over rewriting the text with edit_doc and a <span style="…">: that also works, but it makes you restate the whole run, and retyping text is how text gets silently dropped. NOTE: a direct style change, not a tracked suggestion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNooptional end anchor: a unique snippet; styles the whole span from the start of `from` to the end of `to` (a selection). Must appear after `from`.
tabNoTarget a specific tab by tabId or title (from list_tabs). Defaults to the first tab.
fromNostart anchor: a unique text snippet to style from (quote a slice from read_doc). Required unless whole_document is set.
pageNowhich header/footer, when a doc defines more than one (default-page, first-page, even-page). Omit to use whichever exists.
styleYesstyles to apply
accountNoGoogle account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account.
segmentNowhich content tree to target: body (default), or the page header/footer. Header/footer content is invisible to a body read — a letterhead logo lives there.
documentIdYesGoogle Doc id
whole_documentNostyle the entire document (or tab, or the targeted header/footer) instead of a selection — e.g. to set one font throughout. Mutually exclusive with from/to.
Behavior4/5

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

With no annotations, the description carries full burden. It discloses that this is a 'direct style change, not a tracked suggestion', which is a key behavioral trait. It also clarifies the span semantics for from/to and the in-place (non-content) nature. However, it does not address failure modes (e.g., non-unique snippet) or reversibility, which would further enhance transparency.

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 dense but every sentence earns its place: purpose, targeting rules, style list, workflow hint, alternative comparison, and behavioral note. It is front-loaded with the primary action and uses clear structure (semicolons separating the two targeting modes). No filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 9-parameter tool with a nested style object and no output schema, the description plus the rich input schema cover the necessary context. It adds sequencing (get_style first) and behavior (direct vs suggestion). It does not explicitly mention segment/page/tab targeting, but those are fully described in the schema, so the description does not need to repeat them.

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 baseline is 3, but the description adds real semantics: the from/to span definition ('from the start of the unique from snippet to the end of the unique to snippet'), the mutual exclusivity with whole_document, and a summary of style properties with units (hex, pt, %). This goes beyond the schema's per-parameter hints.

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+resource: 'Apply styling to existing text in place (no content change)'. It clearly distinguishes itself from sibling tools by contrasting with edit_doc ('Prefer this over rewriting the text with edit_doc'), and the 'no content change' phrase uniquely scopes the operation.

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?

Explicit guidance is provided: 'Use get_style first to read current spacing/fonts' and 'Prefer this over rewriting the text with edit_doc'. It also explains the two targeting modes (selection vs whole_document) and notes that retyping text risks silent drops, giving a clear when-to-use rationale.

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/dasasian/gdocs-mcp'

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