Skip to content
Documentation

Reference

ctx_patch

Input contract and parameters for ctx_patch.

Status by featureReviewed September 2026

MCP tool · Read, search & shell

Call this tool through your MCP client. Its availability depends on your active configuration and profile.

This registry contract is separate from the SDK. For terminal commands, use the CLI reference.

Parameters

Generated from the registered input schema. “Required” reflects the schema; individual actions can impose additional requirements.

dry_runboolean
end_hashstring
end_lineinteger
findstring
hashstring
lineinteger
namestring
new_textstring
old_textstring
opstring

Accepted: set_linereplace_linesinsert_afterdeletereplace_uniquereplace_symbolcreatereplace_all

opsarray
pathstring
replacestring
start_hashstring
start_lineinteger

Exact JSON schema

Inspect the complete input schema
{
  "properties": {
    "dry_run": {
      "type": "boolean"
    },
    "end_hash": {
      "type": "string"
    },
    "end_line": {
      "type": "integer"
    },
    "find": {
      "type": "string"
    },
    "hash": {
      "type": "string"
    },
    "line": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "new_text": {
      "type": "string"
    },
    "old_text": {
      "type": "string"
    },
    "op": {
      "enum": [
        "set_line",
        "replace_lines",
        "insert_after",
        "delete",
        "replace_unique",
        "replace_symbol",
        "create",
        "replace_all"
      ],
      "type": "string"
    },
    "ops": {
      "items": {
        "type": "object"
      },
      "type": "array"
    },
    "path": {
      "type": "string"
    },
    "replace": {
      "type": "string"
    },
    "start_hash": {
      "type": "string"
    },
    "start_line": {
      "type": "integer"
    }
  },
  "required": [],
  "type": "object"
}

Runtime description

The following is the tool's own agent-facing description, reproduced from the reviewed registry. It can contain implementation terminology; it does not expand the public stability commitment.

Read the agent-facing description
Safe file edit. Anchored ops use line+hash from ctx_read(mode="anchored"); CONFLICT means re-read. replace_unique(path,old_text,new_text) is a no-read, exact unique replacement. replace_symbol/create/replace_all supported as top-level ops. Cross-file ops[] batch (incl. replace_unique) supported; replace_all and create must be sent as separate top-level calls, not inside ops[].
Sources & versions3 references Reviewed
  • mcp_manifest.rsrust/src/core/mcp_manifest.rsReviewed checkout
  • registry.rsrust/src/server/registry.rsReviewed checkout
  • dynamic_tools.rsrust/src/server/dynamic_tools.rsReviewed checkout
Core checkout
50fbff09c9
Installed runtime
3.10.2
SDK release
1.1.0

Separate baselines for source, CLI/configuration and SDK contracts. Review does not certify every platform or integration.

Versions & compatibility