feat: improve read_file tool descriptions for non-OpenAI models#11192
feat: improve read_file tool descriptions for non-OpenAI models#11192roomote[bot] wants to merge 1 commit intomainfrom
Conversation
Reviewed the tool description changes. Found one minor wording issue that could send mixed signals to models.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| ` IMPORTANT: Indentation mode requires anchor_line to be useful. Without it, only header content (imports) is returned.` | ||
|
|
||
| const limitNote = ` By default, returns up to ${DEFAULT_LINE_LIMIT} lines per file. Lines longer than ${MAX_LINE_LENGTH} characters are truncated.` | ||
| const limitNote = ` Default limit is ${DEFAULT_LINE_LIMIT} lines - use this default by omitting the limit parameter. Only specify a smaller limit if you know the file exceeds ${DEFAULT_LINE_LIMIT} lines and you need pagination. Lines longer than ${MAX_LINE_LENGTH} characters are truncated.` |
There was a problem hiding this comment.
The phrase "Only specify a smaller limit" is logically inconsistent with the pagination use case. If a file exceeds 2000 lines and you need pagination, you'd keep the default limit and adjust the offset for subsequent pages, not specify a "smaller" limit. Specifying a smaller limit would result in more pages of smaller chunks, which is exactly the inefficient behavior this PR aims to prevent. Consider removing the word "smaller" to match the clearer wording in the limit parameter description on line 128.
| const limitNote = ` Default limit is ${DEFAULT_LINE_LIMIT} lines - use this default by omitting the limit parameter. Only specify a smaller limit if you know the file exceeds ${DEFAULT_LINE_LIMIT} lines and you need pagination. Lines longer than ${MAX_LINE_LENGTH} characters are truncated.` | |
| const limitNote = ` Default limit is ${DEFAULT_LINE_LIMIT} lines - use this default by omitting the limit parameter. Only specify a limit if you know the file exceeds ${DEFAULT_LINE_LIMIT} lines and you need pagination. Lines longer than ${MAX_LINE_LENGTH} characters are truncated.` |
Fix it with Roo Code or mention @roomote and request a fix.
Reviewed the tool description changes. Found one minor wording issue that creates internal inconsistency.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
Related GitHub Issue
Closes: #11191
Description
This PR attempts to address Issue #11191 by updating the
read_filetool descriptions to use imperative, directive language rather than passive, descriptive language. This helps non-OpenAI models (particularly Claude Opus) avoid inefficient pagination patterns when reading files.Changes made:
Updated
limitNote: Changed from "By default, returns up to 2000 lines per file" to "Default limit is 2000 lines - use this default by omitting the limit parameter. Only specify a smaller limit if you know the file exceeds 2000 lines and you need pagination."Updated
limitparameter description: Changed from simple default note to explicit guidance: "Omit this parameter to use the default. Only specify a value if you need pagination for files larger than 2000 lines."Updated
modeparameter description: Added clarification that indentation mode "(ignores offset/limit entirely)"Key language principles applied:
Test Procedure
cd src && pnpm vitest run core/prompts/tools/native-tools/__tests__/read_file.spec.tsPre-Submission Checklist
Documentation Updates
Additional Notes
Feedback and guidance are welcome!
Important
Improves
read_filetool descriptions inread_file.tsfor non-OpenAI models by using imperative language and explicit instructions.limitNote: Changed to "Default limit is 2000 lines - use this default by omitting the limit parameter. Only specify a smaller limit if you know the file exceeds 2000 lines and you need pagination."limitparameter: Updated to "Default is 2000. Omit this parameter to use the default. Only specify a value if you need pagination for files larger than 2000 lines."modeparameter: Clarified that indentation mode "ignores offset/limit entirely".This description was created by
for 8dc781e. You can customize this summary. It will automatically update as commits are pushed.