Uses the configured LLM provider (Relace or Morph) to apply a code edit to the original content.
To use this endpoint as an agent tool, follow these guidelines:
Use this tool to make an edit to an existing file. This will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.
When writing the edit, you should specify each edit in sequence, with the special comment ”// … existing code …” to represent unchanged code in between edited lines.
Example format: // … existing code … FIRST_EDIT // … existing code … SECOND_EDIT // … existing code … THIRD_EDIT // … existing code …
You should still bias towards repeating as few lines of the original file as possible to convey the change. But, each edit should contain minimally sufficient context of unchanged lines around the code you’re editing to resolve ambiguity.
DO NOT omit spans of pre-existing code (or comments) without using the ”// … existing code …” comment to indicate its absence. If you omit the existing code comment, the model may inadvertently delete these lines.
If you plan on deleting a section, you must provide context before and after to delete it. If the initial code is “Block 1\nBlock 2\nBlock 3”, and you want to remove Block 2, you would output ”// … existing code …\nBlock 1\nBlock 3\n// … existing code …”.
Make sure it is clear what the edit should be, and where it should be applied. Make edits to a file in a single edit_file call instead of multiple edit_file calls to the same file. The apply model can handle many distinct edits at once.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path to the file to edit (relative to workspace)
Code edit request
Code edit applied successfully
"Code edit applied successfully"
"function hello() {\n console.log('Hello');\n}"
"src/main.js"
"Relace"
true
"function hello(world) {\n console.log('Hello', world);\n}"