Skip to main content
Glama

Edit source files with string replacement

websiteSourceCode_files_strReplace

Atomically applies ordered exact-string edits to up to 50 files and 200 edits in total as one head version. Each oldStr must match once unless replaceAll is true, and any failing edit aborts the whole call. Set dryRun to validate and count replacements without committing. Takes the edit lease when no leaseToken is sent.

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": {
      "websiteId": "<websiteId>",
      "files": "<files>"
    },
    "name": "websiteSourceCode_files_strReplace"
  }
}

Input Schema

NameRequiredDescriptionDefault
filesYesFiles to edit (up to 50, and 200 edits in total). Every edit across every file commits as one version, or none of them do.
dryRunNoValidate every edit and report the replacement counts without committing.
websiteIdYes
leaseTokenNoOmit to have Cactal take the edit lease for you; pass a token from websiteSourceCode.lease.acquire to take over from another editor.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Goes well past the annotations: it discloses all-or-nothing atomicity ('any failing edit aborts the whole call'), uniqueness matching semantics, hard limits (50 files / 200 edits), and a side effect the annotations never reveal — that the call takes the edit lease when no token is sent. That last point is critical for a mutation tool where destructiveHint=false could otherwise understate the lease contention risk.

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?

Four tight sentences, each carrying a distinct fact: atomicity/scope, matching rule and abort behavior, dry-run validation, lease acquisition. The most decision-relevant detail (atomic commit as one head version) is front-loaded.

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 nested, mutating tool with no output schema, it covers limits, failure semantics, validation mode, and lease behavior. Minor gaps: it doesn't say whether the head must be published separately afterward (head_publish exists) or describe permission prerequisites, though the sibling set makes the publish path inferable.

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 75% and already documents `oldStr`, `replaceAll`, `dryRun`, and `leaseToken`, so the description mainly reinforces. It does add one genuine fact absent from the schema — the 200-edit total cap across all files — and clarifies that edits apply in order against evolving content, which matters for chained replacements.

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?

States a specific verb and resource — atomically applies ordered exact-string edits across files, committed as one head version — which is clearly distinct from a full-content write. It does not name the natural alternative (websiteSourceCode_files_upsert) explicitly, so the sibling differentiation is implied rather than stated.

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

Usage Guidelines4/5

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

Gives concrete operational context: set `dryRun` to validate without committing, and omit `leaseToken` to have the lease taken automatically versus passing a token acquired elsewhere. It stops short of explicit when-not guidance (e.g. 'for wholesale rewrites use upsert', or 'read the file first').

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