fix: properly report tool errors in telemetry (#5688)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Akhil Appana
2025-08-08 04:33:42 -07:00
committed by GitHub
parent 5ab184fcaf
commit f5e0f16157
8 changed files with 607 additions and 230 deletions

View File

@@ -17,6 +17,7 @@ import {
ToolConfirmationOutcome,
Icon,
} from './tools.js';
import { ToolErrorType } from './tool-error.js';
import { Type } from '@google/genai';
import { SchemaValidator } from '../utils/schemaValidator.js';
import { getErrorMessage } from '../utils/errors.js';
@@ -186,8 +187,12 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> {
});
if (validationError) {
return {
llmContent: validationError,
llmContent: `Could not execute command due to invalid parameters: ${validationError}`,
returnDisplay: validationError,
error: {
message: validationError,
type: ToolErrorType.INVALID_TOOL_PARAMS,
},
};
}