Skip to main content
Glama
JALAL591

compose-bridge

replace_pattern

Replace all occurrences of a detected conditional or hardcoded pattern across Jetpack Compose project files, creating a new token; preview with dry_run first and roll back if needed.

Instructions

DESTRUCTIVE BATCH OPERATION: Replaces ALL occurrences of a pattern across the project.

What it does: Creates new token + replaces usages. Can be rolled back via rollback_pattern(pattern_id).
When to use: When replacing a recurring conditional or hardcoded pattern across all files.
When NOT to use: USE dry_run=True FIRST to preview affected files. pattern_id must come from detect_conditional_variants.
Side effects: DESTRUCTIVE: Modifies multiple .kt files simultaneously. Records changes in journal.
Parameters:
  - pattern_id: Unique pattern identifier from detect_conditional_variants.
  - dry_run: If True (recommended first), previews changes without writing to disk.
Returns:
  JSON string with replacements made, modified files, and created token name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dry_runNo
pattern_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it labels the operation DESTRUCTIVE, notes it modifies multiple .kt files simultaneously, records changes in a journal, and specifies rollback via rollback_pattern(pattern_id). Safety, reversibility, and write scope are all disclosed.

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?

Front-loaded with the DESTRUCTIVE warning and organized under clear headers, which aids scanning. It is slightly verbose, restating destructiveness in the header and again under side effects, but every section remains relevant.

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?

An output schema exists so return values needn't be documented, yet the description still summarizes the JSON result. Combined with the usage, safety, rollback, and parameter detail, nothing an agent needs to call this destructive tool correctly is missing.

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% (titles only), so the description must compensate and does: pattern_id is defined as a unique identifier sourced from detect_conditional_variants, and dry_run is explained as previewing changes without writing to disk. Both parameters gain meaning beyond the bare 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?

States a specific verb (replaces) with resource (pattern occurrences across the project) and scope (ALL, batch). It explicitly routes the agent by naming detect_conditional_variants as the origin of pattern_id and rollback_pattern as the inverse, so it's distinguishable from all siblings.

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 'When to use' and 'When NOT to use' sections, requiring a dry_run preview first and mandating the pattern_id come from detect_conditional_variants. This is exactly the when/when-not/alternative guidance the rubric reserves top marks for.

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