refactor: use parametersJsonSchema consistently across tool definitions

This commit is contained in:
Aishanee Shah
2026-02-08 04:01:07 +00:00
parent 6227ba73a7
commit ee6a0fa7d1
4 changed files with 3 additions and 14 deletions

View File

@@ -240,7 +240,6 @@ export class GeminiChat {
private sendPromise: Promise<void> = Promise.resolve();
private readonly chatRecordingService: ChatRecordingService;
private lastPromptTokenCount: number;
private lastUsedModel?: string;
constructor(
private readonly config: Config,
@@ -582,10 +581,7 @@ export class GeminiChat {
}
// Track final request parameters for AfterModel hooks
if (modelToUse !== this.lastUsedModel) {
await this.config.getGeminiClient().setTools(modelToUse);
this.lastUsedModel = modelToUse;
}
await this.config.getGeminiClient().setTools(modelToUse);
lastModelToUse = modelToUse;
lastConfig = config;
lastContentsToUse = contentsToUse;

View File

@@ -17,7 +17,7 @@ export const READ_FILE_DEFINITION: ToolDefinition = {
base: {
name: READ_FILE_TOOL_NAME,
description: `Reads and returns the content of a specified file. If the file is large, the content will be truncated. The tool's response will clearly indicate if truncation has occurred and will provide details on how to read more of the file using the 'offset' and 'limit' parameters. Handles text, images (PNG, JPG, GIF, WEBP, SVG, BMP), audio files (MP3, WAV, AIFF, AAC, OGG, FLAC), and PDF files. For text files, it can read specific line ranges.`,
parameters: {
parametersJsonSchema: {
type: Type.OBJECT,
properties: {
file_path: {
@@ -94,7 +94,7 @@ export function getShellDefinition(
base: {
name: SHELL_TOOL_NAME,
description: getShellToolDescription(enableInteractiveShell),
parameters: {
parametersJsonSchema: {
type: Type.OBJECT,
properties: {
command: {

View File

@@ -237,9 +237,6 @@ export class ReadFileTool extends BaseDeclarativeTool<
}
override getSchema(modelId?: string) {
if (!modelId) {
return super.getSchema();
}
return resolveToolDeclaration(READ_FILE_DEFINITION, modelId);
}
}

View File

@@ -515,10 +515,6 @@ export class ShellTool extends BaseDeclarativeTool<
const definition = getShellDefinition(
this.config.getEnableInteractiveShell(),
);
if (!modelId) {
return super.getSchema();
}
return resolveToolDeclaration(definition, modelId);
}
}