Skip to content

feat: improve read_file tool descriptions for non-OpenAI models#11192

Open
roomote[bot] wants to merge 1 commit intomainfrom
feature/improve-read-file-tool-descriptions
Open

feat: improve read_file tool descriptions for non-OpenAI models#11192
roomote[bot] wants to merge 1 commit intomainfrom
feature/improve-read-file-tool-descriptions

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 4, 2026

Related GitHub Issue

Closes: #11191

Description

This PR attempts to address Issue #11191 by updating the read_file tool 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:

  1. 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."

  2. Updated limit parameter 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."

  3. Updated mode parameter description: Added clarification that indentation mode "(ignores offset/limit entirely)"

Key language principles applied:

  • Use imperative verbs: "use this default by omitting" instead of "returns up to"
  • Create conditional barriers: "Only specify... if you know the file exceeds" creates a threshold for parameter usage
  • Give explicit instructions: "Omit this parameter" is directive, not descriptive
  • Emphasize defaults: "Default is X - use this by omitting" makes the preferred behavior clear

Test Procedure

  • Ran existing unit tests: cd src && pnpm vitest run core/prompts/tools/native-tools/__tests__/read_file.spec.ts
  • All 13 tests passed
  • This is a tool description change only, no runtime behavior changes

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

Feedback and guidance are welcome!


Important

Improves read_file tool descriptions in read_file.ts for non-OpenAI models by using imperative language and explicit instructions.

  • Descriptions Updated:
    • 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."
    • limit parameter: 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."
    • mode parameter: Clarified that indentation mode "ignores offset/limit entirely".

This description was created by Ellipsis for 8dc781e. You can customize this summary. It will automatically update as commits are pushed.

@roomote
Copy link
Contributor Author

roomote bot commented Feb 4, 2026

Rooviewer Clock   See task on Roo Cloud

Reviewed the tool description changes. Found one minor wording issue that could send mixed signals to models.

  • Remove "smaller" from limitNote on line 73 to avoid confusing pagination guidance

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.`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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.

@hannesrudolph hannesrudolph marked this pull request as ready for review February 5, 2026 02:31
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. Documentation Improvements or additions to documentation labels Feb 5, 2026
@roomote
Copy link
Contributor Author

roomote bot commented Feb 5, 2026

Rooviewer Clock   See task on Roo Cloud

Reviewed the tool description changes. Found one minor wording issue that creates internal inconsistency.

  • Remove "smaller" from limitNote on line 73 - the current wording contradicts the clearer limit parameter description on line 128

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve read_file tool descriptions to prevent inefficient pagination behavior in non-OpenAI models

1 participant