edit_source
Make targeted edits to one root file or one component part, by exact text replacement — prefer this to update_file / update_component for any change to existing source. Each edit replaces old_string with new_string; old_string must match EXACTLY ONE place (whitespace, indentation and line breaks included), copied from your latest read_file / read_component. Zero matches is NOT_FOUND and several is AMBIGUOUS_MATCH — add surrounding text to make it unique, or set replace_all: true to change every occurrence. To delete, use new_string: ""; to insert, replace an existing block with that block plus the new content. Edits apply in order (a later old_string sees earlier edits) and all-or-nothing: if any edit fails, nothing is written. The result is parsed, validated and formatted like any write. expectedRevision is required. Changes are saved to the catalogue and can queue a thumbnail render that fetches external assets referenced by its content.
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": {
"documentId": "<documentId>",
"expectedRevision": "<expectedRevision>",
"edits": "<edits>",
"llm_model": "<llm_model>"
},
"name": "edit_source"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | A root file to edit. Give this, or componentId + part. | |
| part | No | Which part of the component. | |
| edits | Yes | ||
| llm_model | Yes | The exact model identifier you (the assistant) are running as, taken from your system prompt or environment (e.g. "claude-opus-4-8", "gpt-5.2"). Used for analytics only. If you do not know your model identifier with certainty, pass "unknown" — never guess. | |
| documentId | Yes | The catalogue's id. Call list_documents first if you do not have one. | |
| componentId | No | The component to edit (its id, or its partial name). | |
| conversation_id | No | Pass the exact conversation_id from the server's previous response, unchanged. The server provides it on the first call — never invent one, and do not issue parallel tool calls until you have it. Keep passing the same conversation_id for the rest of the conversation, including after later user messages or on a different task; do not reset it when the user starts a new request. | |
| expectedRevision | Yes | The contentRevision of the read you copied old_string from. |