Skip to content

Commit 210c9ad

Browse files
committed
Improve read_file tool description with examples
- Add explicit JSON structure documentation - Include three concrete examples (single file, with line ranges, multiple files) - Clarify that 'path' is required and 'line_ranges' is optional - Better explain line range format (1-based inclusive) This addresses agent confusion by providing clear examples similar to the XML tool definition.
1 parent e618d88 commit 210c9ad

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/core/prompts/tools/native-tools/read_file.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ export const read_file = {
55
function: {
66
name: "read_file",
77
description:
8-
"Read one or more files and return their contents with line numbers for diffing or discussion. Use line ranges when available to keep reads efficient and combine related files when possible.",
8+
"Read one or more files and return their contents with line numbers for diffing or discussion. " +
9+
"Structure: { files: [{ path: 'relative/path.ts', line_ranges: ['1-50', '100-150'] }] }. " +
10+
"The 'path' is required and relative to workspace. " +
11+
"The 'line_ranges' is optional for reading specific sections (format: 'start-end', 1-based inclusive). " +
12+
"Example single file: { files: [{ path: 'src/app.ts' }] }. " +
13+
"Example with line ranges: { files: [{ path: 'src/app.ts', line_ranges: ['1-50', '100-150'] }] }. " +
14+
"Example multiple files: { files: [{ path: 'file1.ts', line_ranges: ['1-50'] }, { path: 'file2.ts' }] }",
915
strict: true,
1016
parameters: {
1117
type: "object",

0 commit comments

Comments
 (0)