confirm
Finalize and execute pending changes in text files using the standardized API of the editor-mcp server. Ensures accurate and validated file modifications before completion.
Instructions
Confirm action
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/text_editor/server.py:735-758 (handler)Handler function for the 'confirm' tool. Applies pending file modifications from a previous 'overwrite' call by writing pending_modified_lines to the current file. Clears selection and pending state on success. Returns success status or error if no pending changes or write fails.async def confirm() -> Dict[str, Any]: """Confirm action""" if self.pending_modified_lines is None or self.pending_diff is None: return {"error": "No pending changes to apply. Use overwrite first."} try: with open(self.current_file_path, "w", encoding="utf-8") as file: file.writelines(self.pending_modified_lines) result = { "status": "success", "message": f"Changes applied successfully.", } self.selected_start = None self.selected_end = None self.selected_id = None self.pending_modified_lines = None self.pending_diff = None return result except Exception as e: return {"error": f"Error writing to file: {str(e)}"}
- src/text_editor/server.py:735-735 (registration)Registration of the 'confirm' tool using FastMCP's @tool decorator inside TextEditorServer.register_tools() method.async def confirm() -> Dict[str, Any]: