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/grep.ts | |
| parent | f52d073dfbfa4d5091a74bf33ac1c66e51265247 (diff) | |
feat: migrate tools to use parametersJsonSchema. (#5330)
Diffstat (limited to 'packages/core/src/tools/grep.ts')
| -rw-r--r-- | packages/core/src/tools/grep.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/core/src/tools/grep.ts b/packages/core/src/tools/grep.ts index 8e2b84f1..f8ecdc9c 100644 --- a/packages/core/src/tools/grep.ts +++ b/packages/core/src/tools/grep.ts @@ -17,7 +17,6 @@ import { ToolInvocation, ToolResult, } from './tools.js'; -import { Type } from '@google/genai'; import { SchemaValidator } from '../utils/schemaValidator.js'; import { makeRelative, shortenPath } from '../utils/paths.js'; import { getErrorMessage, isNodeError } from '../utils/errors.js'; @@ -550,21 +549,21 @@ export class GrepTool extends BaseDeclarativeTool<GrepToolParams, ToolResult> { pattern: { description: "The regular expression (regex) pattern to search for within file contents (e.g., 'function\\s+myFunction', 'import\\s+\\{.*\\}\\s+from\\s+.*').", - type: Type.STRING, + type: 'string', }, path: { description: 'Optional: The absolute path to the directory to search within. If omitted, searches the current working directory.', - type: Type.STRING, + type: 'string', }, include: { description: "Optional: A glob pattern to filter which files are searched (e.g., '*.js', '*.{ts,tsx}', 'src/**'). If omitted, searches all files (respecting potential global ignores).", - type: Type.STRING, + type: 'string', }, }, required: ['pattern'], - type: Type.OBJECT, + type: 'object', }, ); } @@ -616,7 +615,10 @@ export class GrepTool extends BaseDeclarativeTool<GrepToolParams, ToolResult> { * @returns An error message string if invalid, null otherwise */ validateToolParams(params: GrepToolParams): string | null { - const errors = SchemaValidator.validate(this.schema.parameters, params); + const errors = SchemaValidator.validate( + this.schema.parametersJsonSchema, + params, + ); if (errors) { return errors; } |
