[Fix Telemetry for tool calls, PR 1/n] Propagate tool reported errors via ToolCallResponseInfo and ToolResult (#5222)

This commit is contained in:
Silvio Junior
2025-08-01 11:20:08 -04:00
committed by GitHub
parent 138e52b61e
commit 0d23195624
14 changed files with 224 additions and 25 deletions

View File

@@ -5,6 +5,7 @@
*/
import { FunctionDeclaration, PartListUnion, Schema } from '@google/genai';
import { ToolErrorType } from './tool-error.js';
/**
* Interface representing the base Tool functionality
@@ -217,6 +218,14 @@ export interface ToolResult {
* For now, we keep it as the core logic in ReadFileTool currently produces it.
*/
returnDisplay: ToolResultDisplay;
/**
* If this property is present, the tool call is considered a failure.
*/
error?: {
message: string; // raw error message
type?: ToolErrorType; // An optional machine-readable error type (e.g., 'FILE_NOT_FOUND').
};
}
export type ToolResultDisplay = string | FileDiff;