Skip to main content
Glama

Search and replace in a pad

replace_in_document
Destructive

Replace an exact string in a collaborative pad, editing only matched ranges to avoid conflicts. Use replace_all to change every occurrence, with confirmation for multiple replacements.

Instructions

Replaces an exact string in a pad with another. Only the matched ranges are edited, so concurrent edits elsewhere in the pad survive. By default the search string must match exactly once; set replace_all to change every occurrence. Replacing more than one occurrence at once asks a person first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesId of the pad, the part after # in its URL
searchYesExact string to find (no regex)
replaceYesReplacement; may be empty to delete the match
replace_allNoReplace every occurrence instead of requiring a unique match
confirm_tokenNoConfirmation token from a previous call of this tool with the same arguments. Omit on the first call.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
urlYesShareable; anyone with it can read and edit.
noteYes
charactersYesLength of the pad after the write, in codepoints.
replacementsYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed3 schema fields changedv0.4.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / properties / confirm_token
      Added value: +{
      +  "description": "Confirmation token from a previous call of this tool with the same arguments. Omit on the first call.",
      +  "maxLength": 64,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "characters": {
      +      "description": "Length of the pad after the write, in codepoints.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "id": {
      +      "type": "string"
      +    },
      +    "note": {
      +      "type": "string"
      +    },
      +    "replacements": {
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "url": {
      +      "description": "Shareable; anyone with it can read and edit.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "id",
      +    "url",
      +    "characters",
      +    "note",
      +    "replacements"
      +  ],
      +  "type": "object"
      +}
  2. First observedv0.1.1

TDQS

A4.7/5.0
Behavior5/5

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

Discloses destructive nature (replaces content) and concurrency safety (only matched ranges edited). Explains the confirmation flow for multiple matches, which goes beyond the destructiveHint annotation.

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?

Concise and well-structured: three sentences covering core function, concurrency, and confirmation behavior. No unnecessary fluff.

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?

Given the output schema exists, return values need no explanation. The description adequately covers the two-step confirmation protocol and edge cases (multiple matches, unique match requirement), making the tool's operation clear.

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 covers all parameters with descriptions; the tool description adds useful context for confirm_token (from previous call, omit on first) and replace_all behavior, enhancing schema semantics without redundancy.

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?

Clearly states the tool replaces an exact string in a pad, specifying the resource and action. Distinguishes from sibling tools like set_document or append_to_document by focusing on targeted replacement.

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?

Provides concrete conditions for use: default requires a unique match, replace_all for multiple occurrences, and confirm_token for confirmation. Implicitly contrasts with whole-document edits by noting concurrent edits survive, but does not explicitly name alternative tools.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ni-c/rustpad-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server