Skip to main content
Glama

Embers: Tabletop RPG Toolkit

Replace text inside one adventure page

imagine_replace_in_adventure_page
Idempotent

Surgical find-and-replace inside one adventure page's content. Every byte outside the matched ranges is preserved exactly, so this is the safe primitive for terminology passes (e.g. renaming a monster across a page) where imagine_update_adventure_page's whole-body replace would risk dropping formatting whitespace the LLM can't see in JSON. find matches literally (no regex). All occurrences are replaced in a single pass. Optional expectedOccurrences is a staleness guard — when set, a count mismatch returns 409 with no save instead of silently doing a partial edit. Returns { adventurePage, occurrences }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesMongo `_id` of the adventure page.
findYesLiteral substring to replace inside the page's `content`. Match is literal (no regex); metacharacters are treated as ordinary characters.
replaceYesSubstring to put in place of every occurrence of `find`. May be empty to delete the matched text.
expectedOccurrencesNoOptional staleness guard. When set, the live page MUST contain exactly this many occurrences of `find` or the call fails with 409 and no save lands. Pre-count by fetching the page first if you want this protection.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond annotations (readOnlyHint=false, destructiveHint=false, idempotentHint=true), the description discloses key behaviors: byte-level preservation outside matches, single-pass replacement of all occurrences, the staleness guard returning 409 without saving on count mismatch, and the literal match semantics. This adds substantial behavioral context the annotations do not 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?

Two sentences with no fluff. The first sentence front-loads the core purpose and key differentiator, the second covers matching, guard, and return. Every phrase earns its place, and the structure is easily scannable.

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?

The description covers the essential operational context: the safe usage, the alternative to avoid, the literal matching, the option for a staleness guard with its 409 behavior, and the return format. It even tells the agent to pre-count occurrences if protection is desired. With an output schema available, nothing material is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already fully documents each parameter, including the literal match behavior and the staleness guard. The description adds context like 'single pass' and return value, but these are already implied by schema descriptions and output schema. It provides no new parameter-specific semantics beyond reinforcing the 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?

The description states a specific verb and resource: 'Replace text inside one adventure page's content'. It distinguishes itself from the sibling imagine_update_adventure_page by emphasizing 'surgical find-and-replace' that preserves every byte outside matched ranges, making its unique intent explicit.

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?

Provides explicit usage context: it is the 'safe primitive for terminology passes' and directly contrasts with imagine_update_adventure_page, which 'would risk dropping formatting whitespace the LLM can't see in JSON.' This clearly tells an agent when to pick this tool over the alternative.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources