Skip to content

Commit 32869f5

Browse files
committed
Make limit argument of view tool default to 1000
To prevent prompt overload issues.
1 parent 9906236 commit 32869f5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

agents/tools/text.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,21 @@ class ViewToolInput(BaseModel):
4949
default=None,
5050
)
5151
limit: int | None = Field(
52-
description="For text files only: Maximum number of lines to view",
52+
description=(
53+
"For text files only: Maximum number of lines to view (default: 1000). "
54+
"For large files, use with 'offset' to paginate: offset=0 for lines 0-999, offset=1000 for lines 1000-1999, etc."
55+
),
5356
gt=0,
54-
default=None,
57+
default=1000,
58+
le=1000,
5559
)
5660

5761

5862
class ViewTool(Tool[ViewToolInput, ToolRunOptions, StringToolOutput]):
5963
name = "view"
6064
description = """
61-
Outputs the contents of a file or lists the contents of a directory. Can read an entire file
62-
or a specific range of lines.
65+
Outputs the contents of a file or lists the contents of a directory.
66+
For text files, returns up to 1000 lines by default. Use 'offset' and 'limit' to paginate large text files.
6367
"""
6468
input_schema = ViewToolInput
6569

0 commit comments

Comments
 (0)