Skip to main content
Glama
MIRAI Intelligence & Research MCP

MIRAI Intelligence & Research MCP

by Tarant336

Source Refactor

source_refactor
Destructive

Apply multiple exact find-and-replace edits to a source file atomically, validating each match before writing so failed edits leave the file unchanged.

Instructions

Apply a batch of exact string replacements atomically: every find string is validated for existence and uniqueness before any write happens. Nothing is written when any operation fails validation.

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": {
      "relativePath": "<relativePath>",
      "operations": "<operations>"
    },
    "name": "source_refactor"
  }
}

Input Schema

NameRequiredDescriptionDefault
operationsYesOrdered list of exact find/replace operations.
relativePathYesFile to refactor, relative to the workspace root.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, but the description adds real behavioral context: validation of every find string for existence and uniqueness before any write, and no partial writes on failure. That is the key safety property an agent needs before invoking a destructive batch edit. It stops short of saying what the error response looks like or whether the target file must already exist.

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, front-loaded with the operation and its atomic guarantee, with no filler. Every clause carries either the action or a failure condition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter destructive tool with annotations covering the safety profile, the description supplies the essential contract: all-or-nothing validation. Remaining gaps are the precise meaning of 'uniqueness' (per-file occurrence vs. per-batch) and behavior on a nonexistent file, which matter because they determine whether the call fails.

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 coverage is 100%, so the baseline would be 3, but the description adds a constraint the schema cannot express: each find string must exist and be unique, otherwise the whole batch aborts. That meaningfully changes how an agent should construct the operations array, though the ambiguity of whether 'uniqueness' applies within the file or within the batch is left unresolved.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and operation type — 'apply a batch of exact string replacements' — plus the atomicity model, which is more precise than the title 'Source Refactor'. It doesn't differentiate itself from likely siblings such as source_modify or source_generate, so an agent must infer which mutation tool applies.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The usage is implied: use this when you want several exact replacements in one file applied all-or-nothing. There is no explicit 'use this instead of X' guidance, no statement of prerequisites such as the file already existing, and no note on when a single-edit tool would be preferable.

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