Skip to content

write_file tool => no clear description on content #416

@nick-youngblut

Description

@nick-youngblut

I've found that at least for Claude Haiku 4.5, the model will call the write_file tool many times in a row without providing the content parameter (3-8 times incorrectly before finally providing content). This issue might be alleviated by refining the tool description, currently in which content is never explicitly described as the content of the file:

WRITE_FILE_TOOL_DESCRIPTION = """Writes to a new file in the filesystem.

Usage:
- The file_path parameter must be an absolute path, not a relative path
- The content parameter must be a string
- The write_file tool will create the a new file.
- Prefer to edit existing files over creating new ones when possible."""

While the purpose of the content parameter might seem obvious, it could be interpreted by a naive LLM as "content type" parameter and thus not seen as a truly necessary parameter.

Also, the LLM might be reluctant to write out such a long parameter value to a tool; in my case, the content is >60k tokens. Anecdotally, the reluctancy to provide the content parameter seems to increase as the content size increases (e.g., 8-10 failed tool calls if the content token count is >100k tokens).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions