docs(file-writer): fix accuracy of FileWriterTool page#6374
docs(file-writer): fix accuracy of FileWriterTool page#6374theCyberTech wants to merge 3 commits into
Conversation
The Edge MDX for FileWriterTool had several accuracy issues against the actual tool source (crewai_tools/tools/file_writer_tool/file_writer_tool.py): - Claimed 'supports UTF-8 encoding' but open() is called without an encoding= argument, so behavior follows locale.getpreferredencoding() (UTF-8 on Linux/macOS, cp1252 on stock Windows). Replaced the claim with an accurate note + PYTHONUTF8 guidance. - Did not state the tool is text-only. Added a warning that binary files (images, PDFs, archives, executables) are not supported. - The overwrite argument (overwrite: str | bool = False) was missing entirely from the Arguments list, even though it controls exclusive vs write mode and the already-exists error. Documented it. - The auto-mkdir behavior is conditional on directory being explicitly passed; the docs implied unconditional creation. Clarified. - The example used positional args against _run(self, **kwargs), which would KeyError. Switched to keyword arguments.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
_run is the internal entrypoint; the public API is .run(). Update the example so readers aren't shown calling a private method.
Tools are meant to be handed to an Agent via tools=[...] and invoked by the agent during a task. The previous example called the tool's method directly, which is not how users should use CrewAI tools. Replace with a full agent+task+crew example mirroring the pattern used by sibling tool pages (e.g. seleniumscrapingtool).
What
Fixes accuracy issues on the
FileWriterTooldocs page (docs/edge/en/tools/file-document/filewritetool.mdx) measured against the actual tool source atlib/crewai-tools/src/crewai_tools/tools/file_writer_tool/file_writer_tool.py.Why
The page made claims that don't match the implementation:
open(real_filepath, mode)with noencoding=argument, so the byte encoding followslocale.getpreferredencoding()(UTF-8 on Linux/macOS, typically cp1252 on stock Windows). Replaced with an accurate note + aPYTHONUTF8=1workaround for Windows.content(astr) in text mode. Added a warning that it is not suitable for binary files (images, PDFs, archives, executables) — feeding it binary data raises or corrupts the output.overwriteargument missing from docs. The schema hasoverwrite: str | bool = Falseand it materially changes behavior:False→ exclusive-create mode ("x") + "already exists" error; truthy → write mode ("w"). Documented it.os.makedirsonly runs whendirectoryis explicitly passed (truthy). The default"./"does not trigger creation. Clarified.._run('example.txt', '...', 'test_directory')positionally, but_runisdef _run(self, **kwargs)— positional calls wouldKeyErroronkwargs["filename"]. Switched to keyword arguments.Scope
Only the English Edge source is touched (
docs/edge/en/...), per the docs contributor guide. Frozendocs/v*/snapshots and the shareddocs/images/directory are untouched.Checklist
docs/v*/ordocs/images/changesmintlify broken-linksnot run locally (CI will verify)Draft for now — happy to address feedback before flipping to ready.