@@ -11,7 +11,13 @@ import {
1111 ToolConfirmationOutcome ,
1212 ToolMcpConfirmationDetails ,
1313} from './tools.js' ;
14- import { CallableTool , Part , FunctionCall , Schema } from '@google/genai' ;
14+ import {
15+ CallableTool ,
16+ Part ,
17+ FunctionCall ,
18+ FunctionDeclaration ,
19+ Type ,
20+ } from '@google/genai' ;
1521
1622type ToolParams = Record < string , unknown > ;
1723
@@ -23,7 +29,7 @@ export class DiscoveredMCPTool extends BaseTool<ToolParams, ToolResult> {
2329 readonly serverName : string ,
2430 readonly name : string ,
2531 readonly description : string ,
26- readonly parameterSchema : Schema ,
32+ readonly parameterSchemaJson : unknown ,
2733 readonly serverToolName : string ,
2834 readonly timeout ?: number ,
2935 readonly trust ?: boolean ,
@@ -32,12 +38,24 @@ export class DiscoveredMCPTool extends BaseTool<ToolParams, ToolResult> {
3238 name ,
3339 `${ serverToolName } (${ serverName } MCP Server)` ,
3440 description ,
35- parameterSchema ,
41+ { type : Type . OBJECT } , // this is a dummy Schema for MCP, will be not be used to construct the FunctionDeclaration
3642 true , // isOutputMarkdown
3743 false , // canUpdateOutput
3844 ) ;
3945 }
4046
47+ /**
48+ * Overrides the base schema to use parametersJsonSchema when building
49+ * FunctionDeclaration
50+ */
51+ override get schema ( ) : FunctionDeclaration {
52+ return {
53+ name : this . name ,
54+ description : this . description ,
55+ parametersJsonSchema : this . parameterSchemaJson ,
56+ } ;
57+ }
58+
4159 async shouldConfirmExecute (
4260 _params : ToolParams ,
4361 _abortSignal : AbortSignal ,
0 commit comments