mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-14 08:01:02 -07:00
refactor: use parametersJsonSchema consistently across tool definitions
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -237,9 +237,6 @@ export class ReadFileTool extends BaseDeclarativeTool<
|
||||
}
|
||||
|
||||
override getSchema(modelId?: string) {
|
||||
if (!modelId) {
|
||||
return super.getSchema();
|
||||
}
|
||||
return resolveToolDeclaration(READ_FILE_DEFINITION, modelId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,10 +515,6 @@ export class ShellTool extends BaseDeclarativeTool<
|
||||
const definition = getShellDefinition(
|
||||
this.config.getEnableInteractiveShell(),
|
||||
);
|
||||
if (!modelId) {
|
||||
return super.getSchema();
|
||||
}
|
||||
|
||||
return resolveToolDeclaration(definition, modelId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user