```diff
--- test_files/334-original.txt	2025-03-07 19:06:47
+++ test_files/334-modified.txt	2025-03-07 19:06:47
@@ -1,17 +1,19 @@
+from typing import Dict, Optional
+
 from pydantic import Field
 
-from composio.tools.env.filemanager.manager import FileManager
+from composio.tools.base.local import LocalAction
 from composio.tools.local.filetool.actions.base_action import (
-    BaseFileAction,
     BaseFileRequest,
     BaseFileResponse,
+    include_cwd,
 )
 
 
 class EditFileRequest(BaseFileRequest):
     """Request to edit a file."""
 
-    file_path: str = Field(
+    file_path: Optional[str] = Field(
         default=None,
         description=(
             "The path to the file that will be edited. If not provided, "
@@ -26,35 +28,45 @@
     )
     start_line: int = Field(
         ...,
-        description="The line number at which the file edit will start (REQUIRED)",
+        description=(
+            "The line number at which the file edit will start (REQUIRED). "
+            "Inclusive - the start line will be included in the edit. "
+            "If you just want to add code and not replace any line, "
+            "don't provide end_line field."
+        ),
     )
-    end_line: int = Field(
-        ...,
-        description="The line number at which the file edit will end (REQUIRED).",
+    end_line: Optional[int] = Field(
+        default=None,
+        description=(
+            "The line number at which the file edit will end (REQUIRED). "
+            "Inclusive - the end line will be included in the edit. "
+            "If you just want to add code and not replace any line, "
+            "don't provide this field."
+        ),
     )
 
 
 class EditFileResponse(BaseFileResponse):
     """Response to edit a file."""
 
-    old_text: str = Field(
+    old_text: Optional[str] = Field(
         default=None,
         description=(
             "The updated changes. If the file was not edited, the original file "
             "will be returned."
         ),
     )
-    error: str = Field(
+    error: Optional[str] = Field(
         default=None,
         description="Error message if any",
     )
-    updated_text: str = Field(
+    updated_text: Optional[str] = Field(
         default=None,
         description="The updated text. If the file was not edited, this will be empty.",
     )
 
 
-class EditFile(BaseFileAction):
+class EditFile(LocalAction[EditFileRequest, EditFileResponse]):
     """
     Use this tools to edit a file on specific line numbers.
 
@@ -64,42 +76,50 @@
     If you'd like to add the line '        print(x)' you must fully write
     that out, with all those spaces before the code!
 
-    If the system detects a syntax error, the edit will not be executed.
-    Simply try to edit the file again, but make sure to read the error message
-    and modify the edit command you issue accordingly. Issuing the same command
-    a second time will just lead to the same error message again.
+    If a syntax error is detected, the edit won't be executed. Review the error
+    message and modify your edit command accordingly.
 
-    Raises:
-        - FileNotFoundError: If the file does not exist.
-        - PermissionError: If the user does not have permission to edit the file.
-        - OSError: If an OS-specific error occurs.
-    Note:
-        This action edits a specific part of the file, if you want to rewrite the
-        complete file, use `write` tool instead.
-    """
+    When start and end lines are the same, the new text is inserted at that line,
+    preserving the original line's content.
 
-    _display_name = "Edit a file"
-    _request_schema = EditFileRequest
-    _response_schema = EditFileResponse
+    Ex A: Start=End=1, Text: "print(x)"
+    Result: Adds "print(x)" as first line, rest unchanged.
 
-    def execute_on_file_manager(
-        self,
-        file_manager: FileManager,
-        request_data: EditFileRequest,  # type: ignore
-    ) -> EditFileResponse:
+    Ex B: Start=1, End=3, Text: "print(x)"
+    Result: Replaces lines 1,2 and 3 with "print(x)", rest unchanged.
+
+    This action edits a specific part of the file, if you want to rewrite the
+    complete file, use `write` tool instead."""
+
+    display_name = "Edit a file"
+
+    @include_cwd  # type: ignore
+    def execute(self, request: EditFileRequest, metadata: Dict) -> EditFileResponse:
+        file_manager = self.filemanagers.get(request.file_manager_id)
         try:
             file = (
                 file_manager.recent
-                if request_data.file_path is None
-                else file_manager.open(
-                    path=request_data.file_path,
-                )
+                if request.file_path is None
+                else file_manager.open(path=request.file_path)
             )
+
+            if file is None:
+                raise FileNotFoundError(f"File not found: {request.file_path}")
+
+            if request.end_line is None:
+                request.end_line = -1
+
             response = file.write_and_run_lint(
-                text=request_data.text,
-                start=request_data.start_line,
-                end=request_data.end_line,
+                text=request.text,
+                start=request.start_line,
+                end=request.end_line,
             )
+            if response.get("error") and len(response["error"]) > 0:  # type: ignore
+                return EditFileResponse(
+                    old_text=response["replaced_text"],
+                    updated_text=response["replaced_with"],
+                    error="No Update, found error: " + response["error"],  # type: ignore
+                )
             return EditFileResponse(
                 old_text=response["replaced_text"],
                 updated_text=response["replaced_with"],
```
