mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-14 05:42:54 -07:00
This commit is contained in:
+10
-4
@@ -319,6 +319,7 @@ exports[`coreTools snapshots for specific models > Model: gemini-2.5-pro > snaps
|
||||
},
|
||||
"context": {
|
||||
"description": "Show this many lines of context around each match (equivalent to grep -C). Defaults to 0 if omitted.",
|
||||
"minimum": 0,
|
||||
"type": "integer",
|
||||
},
|
||||
"dir_path": {
|
||||
@@ -416,7 +417,8 @@ exports[`coreTools snapshots for specific models > Model: gemini-2.5-pro > snaps
|
||||
"properties": {
|
||||
"end_line": {
|
||||
"description": "Optional: The 1-based line number to end reading at (inclusive).",
|
||||
"type": "number",
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
},
|
||||
"file_path": {
|
||||
"description": "The path to the file to read.",
|
||||
@@ -424,7 +426,8 @@ exports[`coreTools snapshots for specific models > Model: gemini-2.5-pro > snaps
|
||||
},
|
||||
"start_line": {
|
||||
"description": "Optional: The 1-based line number to start reading from.",
|
||||
"type": "number",
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
@@ -1149,6 +1152,7 @@ exports[`coreTools snapshots for specific models > Model: gemini-3-pro-preview >
|
||||
},
|
||||
"context": {
|
||||
"description": "Show this many lines of context around each match (equivalent to grep -C). Defaults to 0 if omitted.",
|
||||
"minimum": 0,
|
||||
"type": "integer",
|
||||
},
|
||||
"dir_path": {
|
||||
@@ -1246,7 +1250,8 @@ exports[`coreTools snapshots for specific models > Model: gemini-3-pro-preview >
|
||||
"properties": {
|
||||
"end_line": {
|
||||
"description": "Optional: The 1-based line number to end reading at (inclusive).",
|
||||
"type": "number",
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
},
|
||||
"file_path": {
|
||||
"description": "The path to the file to read.",
|
||||
@@ -1254,7 +1259,8 @@ exports[`coreTools snapshots for specific models > Model: gemini-3-pro-preview >
|
||||
},
|
||||
"start_line": {
|
||||
"description": "Optional: The 1-based line number to start reading from.",
|
||||
"type": "number",
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
|
||||
@@ -97,12 +97,14 @@ export const DEFAULT_LEGACY_SET: CoreToolSet = {
|
||||
[READ_FILE_PARAM_START_LINE]: {
|
||||
description:
|
||||
'Optional: The 1-based line number to start reading from.',
|
||||
type: 'number',
|
||||
type: 'integer',
|
||||
minimum: 1,
|
||||
},
|
||||
[READ_FILE_PARAM_END_LINE]: {
|
||||
description:
|
||||
'Optional: The 1-based line number to end reading at (inclusive).',
|
||||
type: 'number',
|
||||
type: 'integer',
|
||||
minimum: 1,
|
||||
},
|
||||
},
|
||||
required: [PARAM_FILE_PATH],
|
||||
@@ -223,6 +225,7 @@ export const DEFAULT_LEGACY_SET: CoreToolSet = {
|
||||
description:
|
||||
'Show this many lines of context around each match (equivalent to grep -C). Defaults to 0 if omitted.',
|
||||
type: 'integer',
|
||||
minimum: 0,
|
||||
},
|
||||
[GREP_PARAM_AFTER]: {
|
||||
description:
|
||||
|
||||
@@ -106,12 +106,14 @@ export const GEMINI_3_SET: CoreToolSet = {
|
||||
[READ_FILE_PARAM_START_LINE]: {
|
||||
description:
|
||||
'Optional: The 1-based line number to start reading from.',
|
||||
type: 'number',
|
||||
type: 'integer',
|
||||
minimum: 1,
|
||||
},
|
||||
[READ_FILE_PARAM_END_LINE]: {
|
||||
description:
|
||||
'Optional: The 1-based line number to end reading at (inclusive).',
|
||||
type: 'number',
|
||||
type: 'integer',
|
||||
minimum: 1,
|
||||
},
|
||||
},
|
||||
required: [PARAM_FILE_PATH],
|
||||
@@ -230,6 +232,7 @@ export const GEMINI_3_SET: CoreToolSet = {
|
||||
description:
|
||||
'Show this many lines of context around each match (equivalent to grep -C). Defaults to 0 if omitted.',
|
||||
type: 'integer',
|
||||
minimum: 0,
|
||||
},
|
||||
[GREP_PARAM_AFTER]: {
|
||||
description:
|
||||
|
||||
@@ -148,18 +148,20 @@ describe('ReadFileTool', () => {
|
||||
|
||||
it('should throw error if start_line is less than 1', () => {
|
||||
const params: ReadFileToolParams = {
|
||||
file_path: path.join(tempRootDir, 'test.txt'),
|
||||
file_path: 'test.txt',
|
||||
start_line: 0,
|
||||
};
|
||||
expect(() => tool.build(params)).toThrow('start_line must be at least 1');
|
||||
expect(() => tool.build(params)).toThrow(
|
||||
'params/start_line must be >= 1',
|
||||
);
|
||||
});
|
||||
|
||||
it('should throw error if end_line is less than 1', () => {
|
||||
const params: ReadFileToolParams = {
|
||||
file_path: path.join(tempRootDir, 'test.txt'),
|
||||
file_path: 'test.txt',
|
||||
end_line: 0,
|
||||
};
|
||||
expect(() => tool.build(params)).toThrow('end_line must be at least 1');
|
||||
expect(() => tool.build(params)).toThrow('params/end_line must be >= 1');
|
||||
});
|
||||
|
||||
it('should throw error if start_line is greater than end_line', () => {
|
||||
|
||||
@@ -255,12 +255,6 @@ export class ReadFileTool extends BaseDeclarativeTool<
|
||||
return validationError;
|
||||
}
|
||||
|
||||
if (params.start_line !== undefined && params.start_line < 1) {
|
||||
return 'start_line must be at least 1';
|
||||
}
|
||||
if (params.end_line !== undefined && params.end_line < 1) {
|
||||
return 'end_line must be at least 1';
|
||||
}
|
||||
if (
|
||||
params.start_line !== undefined &&
|
||||
params.end_line !== undefined &&
|
||||
|
||||
Reference in New Issue
Block a user