Skip to main content
Glama

apply_theme

Destructive

Apply a theme dict to a Google Doc by updating named style defaults for text and tables. Optionally overwrite existing paragraph styles to restyle all current content.

Instructions

Apply a theme dict to a Google Doc by updating its named style definitions.

By default (overwrite=False), theme entries are applied as document-level named style defaults via updateNamedStyle. Paragraphs that have explicit individual style overrides are unaffected — their styles take precedence over the named style defaults. This preserves intentional per-paragraph variations (e.g. a section deliberately styled in a different colour). One exception: a NORMAL_TEXT entry with space_above or space_below replaces the 10pt space below a paragraph that a Markdown or HTML write leaves between paragraphs, so the theme's spacing shows.

For AI-generated docs where all content uses explicit paragraph/run styles, the default mode updates the named style definitions but does not visually change existing content. New paragraphs added without explicit styles will inherit the updated named style defaults.

Set overwrite=True to also apply the theme directly to all existing paragraphs, overwriting their current styles including any individual overrides.

Theme entry keys (NORMAL_TEXT, HEADING_1-6, TITLE, SUBTITLE). Each entry can include (all optional): font_family (str), font_size (float, points), bold (bool), italic (bool), color (dict {"red": 0-1, "green": 0-1, "blue": 0-1}), line_spacing (float, 100=single, 115=1.15x, 150=1.5x), space_above (float, points), space_below (float, points)

An optional "table" key applies styling to every table currently in the document: border_color (dict), border_width (float, points), border_dash_style (str, default "SOLID"), border_top, border_right, border_bottom, border_left (dict): optional per-edge override, each {"color": {...}, "width": float, "dash_style": str}. Any field omitted from a per-edge dict falls back to the uniform border_color/border_width/border_dash_style above, if given (the Docs API rejects a border with non-zero width and no color as "transparent", so a width-only override needs a color from somewhere). An edge with no border_ key falls back entirely to the uniform border_color/ border_width/border_dash_style, if given. cell_padding (float, points — all four sides), header_background (dict) — first row only

Args: doc_id: The Google Doc file ID. theme: Theme dict. See above for schema. overwrite: If True, also apply styles directly to existing paragraphs, overwriting individual per-paragraph style overrides.

Returns: Confirmation with docId and count of batchUpdate requests sent.

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>",
      "theme": "<theme>"
    },
    "name": "apply_theme"
  }
}

Input Schema

NameRequiredDescriptionDefault
themeYes
doc_idYes
overwriteNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.6

TDQS

A4.7/5.0
Behavior4/5

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

With only destructiveHint=true in annotations, the description carries the real disclosure burden and does most of it: it states that default mode leaves per-paragraph overrides intact, names the NORMAL_TEXT spacing exception, and warns that overwrite=True clobbers individual styles. It even explains an API constraint ('rejects a border with non-zero width and no color as transparent'). Minor gap: it never mentions auth/scopes or that table styling applies to tables 'currently in the document' only in a passing phrase rather than as an explicit limitation.

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?

Purpose and the default-vs-overwrite decision are front-loaded, and the long block is defensible because the theme dict has no schema anywhere else. Still, some prose (the repeated per-edge fallback restatement) could be tightened, and the trailing 'Args:' section largely repeats points already made in the body.

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 tool with a nested free-form object and an output schema, the definition covers semantics, mode behavior, structural schema, and the shape of the return ('docId and count of batchUpdate requests'). Nothing an agent needs to construct a correct call is absent.

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% and theme is an open additionalProperties object, so the description is the only specification — and it delivers: it enumerates theme entry keys, every optional style field with units and ranges (color 0-1, line_spacing 100=single), and the nested table/border structure with fallback rules. It adds far more than the permissive schema does.

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 first sentence states a specific verb ('Apply'), resource ('a Google Doc'), and mechanism ('updating its named style definitions'), which cleanly separates it from the read-only sibling get_doc_theme. An agent knows immediately what the tool does and roughly what it touches.

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?

It explicitly contrasts the default mode (overwrite=False) with overwrite=True, and names a concrete situation where the default fails to visibly change content ('AI-generated docs where all content uses explicit paragraph/run styles'). That is real when-to-use guidance with a documented trade-off rather than a restatement of parameters.

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