confirm
Finalize pending operations in the editor-mcp server to apply changes to text files. Use this tool to complete file editing tasks after making modifications.
Instructions
Confirm action
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/text_editor/server.py:735-758 (handler)The 'confirm' tool handler function. It checks for pending changes, writes the modified lines to the current file, clears the pending state and selection, and returns success or error status.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)}"}