Skip to main content
Glama

replace_in_html_file

Replaces the first occurrence of a specific string with replacement text in an HTML tool file, enabling targeted edits within a workspace document.

Instructions

Replace a specific string in an HTML tool file in a workspace. Finds the first occurrence of searchText and replaces it with replaceText.

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": {
      "workspacePath": "<workspacePath>",
      "filePath": "<filePath>",
      "searchText": "<searchText>",
      "replaceText": "<replaceText>"
    },
    "name": "replace_in_html_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
filePathYesFile path relative to the workspace root (e.g. "resources/html/my-tool/index.html")
searchTextYesText to search for (must be unique enough to identify the exact location)
replaceTextYesText to replace it with
workspacePathYesAbsolute path to the workspace directory

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.0

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full behavioral burden. It usefully discloses that only the FIRST occurrence is replaced, but says nothing about what happens when searchText is absent, whether the file is modified on disk, whether it requires the file to already exist, or what the response contains. For an unannotated mutation tool that is a substantial gap.

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 short sentences, zero waste, with the match-and-replace semantics front-loaded. Nothing is padded or restated.

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

Completeness3/5

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

With four required string parameters fully documented in the schema and no output schema, the description covers the happy path adequately. It is incomplete for a write operation with no annotations: failure modes (searchText not found, nonexistent file/workspace), write/permission semantics, and return value are all unaddressed.

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 all four parameters are already documented in the schema (including the uniqueness caveat on searchText). The description adds only the first-occurrence matching rule, which is a behavioral detail rather than parameter syntax. Baseline 3 is appropriate.

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?

Names a specific verb (replace) and resource (a string inside an HTML tool file in a workspace), plus the exact matching rule. An agent can tell it is a targeted in-place edit rather than a whole-file write. It does not explicitly name how it differs from siblings like write_html_file, edit_html_tool, or replace_content.

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?

Usage is implied by the description: use this for a narrow, single-string edit rather than rewriting a file. There is no explicit when-to-use/when-not-use statement and no routing to the plausibly overlapping siblings (replace_content, edit_html_tool, write_html_file).

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