Skip to main content
Glama

apply_style

Apply a named style to specified text ranges or matching patterns in Word documents, with optional auto-backup and atomic saves.

Instructions

Apply a named style. range={start,end} (locations or bare indices) applies a paragraph style to those paragraphs, changing their full look (Heading1-9 auto-created); target={search:{text, occurrence?}} applies a character style to the matched text instead. For an outline level without visual change use set_paragraph_format. Auto-backup (backup=False skips rotation); atomic validated save. Refuses documents open in Word. For batches, use apply_edits. Defining new named styles lives in the academic pack.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rangeNo
styleYes
backupNo
targetNo
file_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv2.0.0
    • removedInput schema / properties / indices
      Removed value: -{
      -  "items": {
      -    "type": "integer"
      -  },
      -  "type": "array"
      -}
    • addedInput schema / properties / range
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedInput schema / properties / target
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • changedInput schema / required
      Previous value: -[
      -  "file_path",
      -  "indices",
      -  "style"
      -]New value: +[
      +  "file_path",
      +  "style"
      +]
  2. First observedv1.2.1

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the readOnlyHint=false annotation, the description discloses important behaviors: auto-backup rotation, backup=False skip, atomic validated save, refusal of documents open in Word, and Heading1-9 auto-creation. This gives the agent critical side-effect information that annotations alone would not convey. No contradiction with annotations exists.

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?

The description is dense and packed with useful distinctions, alternatives, and behaviors, with no filler. It is slightly long, but every sentence adds operational value. The front-loaded purpose and mode split make it easy to parse despite the density.

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?

Given this is a mutation tool with five parameters, zero schema description coverage, and only readOnlyHint=false as annotation context, the description is remarkably complete. It covers the two operation modes, the relevant parameter behavior, error-prone states (Word-open refusal), save safety, and batch workflow routing. The presence of an output schema means return-value details are not required here.

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 must compensate, and it does. It defines the range parameter shape ('{start,end} (locations or bare indices)'), the target parameter shape ('{search:{text, occurrence?}}'), and the backup parameter's effect ('backup=False skips rotation'). It even clarifies that style refers to a named style and that defining new named styles belongs to the academic pack.

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 and resource: 'Apply a named style.' It then distinguishes two distinct modes—paragraph style via range and character style via target—so an agent immediately knows what operation is being performed. It also separates itself from set_paragraph_format and apply_edits, making purpose unambiguous.

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 says when to use an alternative: 'For an outline level without visual change use set_paragraph_format' and 'For batches, use apply_edits.' It also explains when to chose range versus target ('applies a paragraph style' vs. 'applies a character style to the matched text instead'), leaving little to inference.

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