diff --git a/.changeset/hungry-lands-sin.md b/.changeset/hungry-lands-sin.md new file mode 100644 index 00000000000..65a68b98412 --- /dev/null +++ b/.changeset/hungry-lands-sin.md @@ -0,0 +1,5 @@ +--- +"kilo-code": patch +--- + +Reduce the incidence of read_file errors when using Claude models. diff --git a/src/core/prompts/tools/native-tools/read_file.ts b/src/core/prompts/tools/native-tools/read_file.ts index bf43f26c8af..6f8fa8ed396 100644 --- a/src/core/prompts/tools/native-tools/read_file.ts +++ b/src/core/prompts/tools/native-tools/read_file.ts @@ -19,6 +19,22 @@ export function createReadFileTool(partialReadsEnabled: boolean = true): OpenAI. " }] }. " + "The 'path' is required and relative to workspace. " + // kilocode_change start + const example = { + files: [ + { + path: "relative/path.ts", + line_ranges: partialReadsEnabled + ? [ + [1, 50], + [100, 150], + ] + : undefined, + }, + ], + } + // kilocode_change end + const optionalRangesDescription = partialReadsEnabled ? "The 'line_ranges' is optional for reading specific sections. Each range is a [start, end] tuple (1-based inclusive). " : "" @@ -81,6 +97,7 @@ export function createReadFileTool(partialReadsEnabled: boolean = true): OpenAI. }, }, required: ["files"], + examples: [example], // kilocode_change additionalProperties: false, }, },