diff options
| author | Wanlin Du <[email protected]> | 2025-08-11 16:12:41 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-11 23:12:41 +0000 |
| commit | d9fb08c9da3d2e8c501ec9badb2e2bd79eb15b93 (patch) | |
| tree | 7d07e1586b736c1b6c44e28828aa29205af335ac /packages/core/src/tools/read-file.ts | |
| parent | f52d073dfbfa4d5091a74bf33ac1c66e51265247 (diff) | |
feat: migrate tools to use parametersJsonSchema. (#5330)
Diffstat (limited to 'packages/core/src/tools/read-file.ts')
| -rw-r--r-- | packages/core/src/tools/read-file.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/core/src/tools/read-file.ts b/packages/core/src/tools/read-file.ts index 2ab50282..0c040b66 100644 --- a/packages/core/src/tools/read-file.ts +++ b/packages/core/src/tools/read-file.ts @@ -16,7 +16,7 @@ import { ToolResult, } from './tools.js'; import { ToolErrorType } from './tool-error.js'; -import { PartUnion, Type } from '@google/genai'; +import { PartUnion } from '@google/genai'; import { processSingleFileContent, getSpecificMimeType, @@ -179,27 +179,30 @@ export class ReadFileTool extends BaseDeclarativeTool< absolute_path: { description: "The absolute path to the file to read (e.g., '/home/user/project/file.txt'). Relative paths are not supported. You must provide an absolute path.", - type: Type.STRING, + type: 'string', }, offset: { description: "Optional: For text files, the 0-based line number to start reading from. Requires 'limit' to be set. Use for paginating through large files.", - type: Type.NUMBER, + type: 'number', }, limit: { description: "Optional: For text files, maximum number of lines to read. Use with 'offset' to paginate through large files. If omitted, reads the entire file (if feasible, up to a default limit).", - type: Type.NUMBER, + type: 'number', }, }, required: ['absolute_path'], - type: Type.OBJECT, + type: 'object', }, ); } protected validateToolParams(params: ReadFileToolParams): string | null { - const errors = SchemaValidator.validate(this.schema.parameters, params); + const errors = SchemaValidator.validate( + this.schema.parametersJsonSchema, + params, + ); if (errors) { return errors; } |
