mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 14:34:55 -07:00
refactor(core): model-dependent tool definitions (#18563)
This commit is contained in:
@@ -312,8 +312,15 @@ export interface ToolBuilder<
|
||||
|
||||
/**
|
||||
* Function declaration schema from @google/genai.
|
||||
* @param modelId Optional model identifier to get a model-specific schema.
|
||||
*/
|
||||
schema: FunctionDeclaration;
|
||||
getSchema(modelId?: string): FunctionDeclaration;
|
||||
|
||||
/**
|
||||
* Function declaration schema for the default model.
|
||||
* @deprecated Use getSchema(modelId) for model-specific schemas.
|
||||
*/
|
||||
readonly schema: FunctionDeclaration;
|
||||
|
||||
/**
|
||||
* Whether the tool's output should be rendered as markdown.
|
||||
@@ -355,7 +362,7 @@ export abstract class DeclarativeTool<
|
||||
readonly extensionId?: string,
|
||||
) {}
|
||||
|
||||
get schema(): FunctionDeclaration {
|
||||
getSchema(_modelId?: string): FunctionDeclaration {
|
||||
return {
|
||||
name: this.name,
|
||||
description: this.description,
|
||||
@@ -363,6 +370,10 @@ export abstract class DeclarativeTool<
|
||||
};
|
||||
}
|
||||
|
||||
get schema(): FunctionDeclaration {
|
||||
return this.getSchema();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the raw tool parameters.
|
||||
* Subclasses should override this to add custom validation logic
|
||||
|
||||
Reference in New Issue
Block a user