Tools for agents: Guarded text edit application
Apply multiple checked replacements to text with stale-content guards, overlap rejection and result offsets.
Connect with MCP
{
"mcpServers": {
"super-agent-tools": {
"url": "https://app.getsupers.com/sites/agent-text-edits/mcp"
}
}
}Use this URL in any client supporting remote Streamable HTTP MCP. Calls return structured JSON; inputs are processed without persistence.
Call apply_guarded_text_edits
All start/end offsets refer to the original document, use zero-based Unicode code points, and are half-open. Inputs may arrive in any order; edits are applied in increasing original offset order. expected must equal the complete original slice exactly, including whitespace. Any mismatch, invalid range or overlap fails the entire call without a partial result. Insertions use start=end and expected empty. Two edits sharing a start are rejected as ambiguous, including insertion plus replacement; an insertion at the preceding replacement end is permitted when starts differ. Adjacent replacements are permitted. No Unicode normalization, newline conversion, fuzzy matching or file access occurs. Empty edits return the unchanged text. applied gives each original input index and its result span, in application order. SHA-256 values hash UTF-8 text without a BOM added by the tool. This returns transformed text; it does not edit a repository or file. Use the Unicode span tool to convert UTF-8/UTF-16 offsets first.
Input and output schemas
{
"name": "apply_guarded_text_edits",
"title": "Guarded text edit application",
"description": "Apply nonoverlapping half-open replacements after validating every original-text guard. Offsets are Unicode code points, all relative to the original text. No filesystem writes.",
"inputSchema": {
"$defs": {
"TextEdit": {
"properties": {
"start": {
"title": "Start",
"type": "integer"
},
"end": {
"title": "End",
"type": "integer"
},
"expected": {
"title": "Expected",
"type": "string"
},
"replacement": {
"title": "Replacement",
"type": "string"
}
},
"required": [
"start",
"end",
"expected",
"replacement"
],
"title": "TextEdit",
"type": "object"
}
},
"properties": {
"text": {
"title": "Text",
"type": "string"
},
"edits": {
"items": {
"$ref": "#/$defs/TextEdit"
},
"title": "Edits",
"type": "array"
}
},
"required": [
"text",
"edits"
],
"title": "apply_guarded_text_editsArguments",
"type": "object"
},
"outputSchema": {
"additionalProperties": true,
"title": "apply_guarded_text_editsDictOutput",
"type": "object"
},
"icons": null,
"annotations": {
"title": null,
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
},
"meta": null,
"execution": null
}Run the example to see the actual result.
HTTP alternative
POST https://app.getsupers.com/sites/agent-text-edits/call
Content-Type: application/json
{
"text": "alpha beta gamma",
"edits": [
{
"start": 0,
"end": 5,
"expected": "alpha",
"replacement": "A"
},
{
"start": 11,
"end": 16,
"expected": "gamma",
"replacement": "G"
}
]
}The HTTP and MCP interfaces execute the same implementation. Validation errors are returned explicitly. See the tool notes above for its supported inputs and behavior.