Improve Function Call argument validation and typing (#2881)

Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Tommaso Sciortino
2025-07-07 23:48:44 -07:00
committed by GitHub
parent 137ffec3f6
commit 4dab31f1c8
22 changed files with 239 additions and 246 deletions

View File

@@ -80,8 +80,8 @@ describe('GrepTool', () => {
it('should return error if pattern is missing', () => {
const params = { path: '.' } as unknown as GrepToolParams;
expect(grepTool.validateToolParams(params)).toContain(
'Parameters failed schema validation',
expect(grepTool.validateToolParams(params)).toBe(
`params must have required property 'pattern'`,
);
});
@@ -204,11 +204,11 @@ describe('GrepTool', () => {
it('should return an error if params are invalid', async () => {
const params = { path: '.' } as unknown as GrepToolParams; // Invalid: pattern missing
const result = await grepTool.execute(params, abortSignal);
expect(result.llmContent).toContain(
'Error: Invalid parameters provided. Reason: Parameters failed schema validation',
expect(result.llmContent).toBe(
"Error: Invalid parameters provided. Reason: params must have required property 'pattern'",
);
expect(result.returnDisplay).toContain(
'Model provided invalid parameters. Error: Parameters failed schema validation',
expect(result.returnDisplay).toBe(
"Model provided invalid parameters. Error: params must have required property 'pattern'",
);
});
});