```diff
--- test_files/331-original.txt	2025-03-07 19:06:47
+++ test_files/331-modified.txt	2025-03-07 19:06:47
@@ -1,17 +1,19 @@
+import typing as t
+
 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 WriteRequest(BaseFileRequest):
     """Request to write a file."""
 
-    file_path: str = Field(
+    file_path: t.Optional[str] = Field(
         default=None,
         description=(
             "The path to the file that will be edited. If not provided, "
@@ -35,33 +37,27 @@
     )
 
 
-class Write(BaseFileAction):
+class Write(LocalAction[WriteRequest, WriteResponse]):
     """
     Write the given content to a file.
 
     Note:
         This action will replace the existing content in the the file,
-    and completetly rewrite the file, if you want to edit a specific portion
+    and completely rewrite the file, if you want to edit a specific portion
     of the file use `edit` tool instead.
     """
 
-    _display_name = "Edit a file"
-    _request_schema = WriteRequest
-    _response_schema = WriteResponse
-
-    def execute_on_file_manager(
-        self,
-        file_manager: FileManager,
-        request_data: WriteRequest,  # type: ignore
-    ) -> WriteResponse:
+    @include_cwd  # type: ignore
+    def execute(self, request: WriteRequest, metadata: t.Dict) -> WriteResponse:
         try:
-            (
-                file_manager.recent
-                if request_data.file_path is None
-                else file_manager.open(
-                    path=request_data.file_path,
-                )
-            ).write(text=request_data.text)
+            filemanager = self.filemanagers.get(request.file_manager_id)
+            file = (
+                filemanager.recent
+                if request.file_path is None
+                else filemanager.open(path=request.file_path)
+            )
+            assert file is not None
+            file.write(text=request.text)
             return WriteResponse()
         except FileNotFoundError as e:
             return WriteResponse(error=f"File not found: {str(e)}")
```
