Skip to main content
Glama

replace_formatted

Replace text only where specific formatting (bold, italic, font, color, style) matches, preserving that formatting. Safe across fragmented runs; aborts if limit exceeded.

Instructions

Replace text ONLY where it carries specific EFFECTIVE formatting: the mutation twin of find_formatted, same criteria keys (bold/italic/underline/strike, font, size_pt, color, highlight, style), all required together, resolved the way Word resolves them. find=None replaces each entire matching stretch; with find (literal, case-sensitive), only occurrences wholly inside a matching stretch. Safe across fragmented runs; the replacement keeps the matched formatting. Result mirrors search_and_replace ({replaced, total}) plus per-replacement matched_via. No regex here (search_and_replace covers that); text boxes are never touched (set_textbox_text edits those). max_replacements aborts, changing nothing, past the cap. Auto-backup: prev/anchor slots in .ks4w-backups (backup=False skips rotation only); atomic validated save. Refuses documents open in Word.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
findNo
scopeNobody
backupNo
replaceYes
file_pathYes
formattingYes
max_replacementsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations provided, the description carries the full burden, and it excels: it explains fragmented-run safety, formatting preservation, max_replacements abort semantics, auto-backup behavior, atomic validated save, and refusal to modify documents open in Word. This goes far beyond what the schema or annotations provide.

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. It leads with the core purpose, immediately clarifies scope of matching, and then packs in essential edge cases, exclusions, and safety semantics without repetition or fluff.

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?

This is a high-complexity tool with 7 parameters, nested formatting objects, an output schema, and many sibling tools that overlap. The description covers selection criteria, replacement behavior, safety, sibling distinctions, output shape, and failure semantics. Nothing critical is missing for an agent to invoke it correctly.

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 description coverage is 0%, so the description must compensate. It explains find (None vs literal), replace, max_replacements (cap aborts changing nothing), backup (backup=False skips rotation only), and the formatting criteria keys. However, it never explains the 'scope' parameter, which is non-obvious and has a default in the schema. This is a meaningful gap given the total absence of schema descriptions.

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 uses a specific verb and resource: 'Replace text ONLY where it carries specific EFFECTIVE formatting'. It also immediately distinguishes itself as 'the mutation twin of find_formatted', making its relationship to a sibling tool explicit. This is exactly the clarity needed for an agent to tell it apart from related tools.

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?

The description gives precise behavioral when-to-use guidance: find=None replaces entire matching stretches; with find, only occurrences wholly inside a matching stretch. It also explicitly routes alternatives: 'No regex here (search_and_replace covers that)' and 'text boxes are never touched (set_textbox_text edits those)'. This is model guidance for tool selection.

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/nometalalchemist/KitchenSink4Word'

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