summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/mcp-tool.ts
diff options
context:
space:
mode:
authorWanlin Du <[email protected]>2025-07-16 14:32:34 -0700
committerGitHub <[email protected]>2025-07-16 21:32:34 +0000
commitf6ee0d182bcb6c9c6e3c9d34174d8d984bbddb37 (patch)
treecdfe052e9124b21a3567d3b495882dec57664f11 /packages/core/src/tools/mcp-tool.ts
parent21eb44b242e045cad957d21b049d00b55abf9489 (diff)
fix: update google/genai to v1.9.0 and switch to parametersJsonSchema for MCP related tools (#4176)
Co-authored-by: Jack Wotherspoon <[email protected]>
Diffstat (limited to 'packages/core/src/tools/mcp-tool.ts')
-rw-r--r--packages/core/src/tools/mcp-tool.ts24
1 files changed, 21 insertions, 3 deletions
diff --git a/packages/core/src/tools/mcp-tool.ts b/packages/core/src/tools/mcp-tool.ts
index cc4739a4..663ec6ee 100644
--- a/packages/core/src/tools/mcp-tool.ts
+++ b/packages/core/src/tools/mcp-tool.ts
@@ -11,7 +11,13 @@ import {
ToolConfirmationOutcome,
ToolMcpConfirmationDetails,
} from './tools.js';
-import { CallableTool, Part, FunctionCall, Schema } from '@google/genai';
+import {
+ CallableTool,
+ Part,
+ FunctionCall,
+ FunctionDeclaration,
+ Type,
+} from '@google/genai';
type ToolParams = Record<string, unknown>;
@@ -23,7 +29,7 @@ export class DiscoveredMCPTool extends BaseTool<ToolParams, ToolResult> {
readonly serverName: string,
readonly name: string,
readonly description: string,
- readonly parameterSchema: Schema,
+ readonly parameterSchemaJson: unknown,
readonly serverToolName: string,
readonly timeout?: number,
readonly trust?: boolean,
@@ -32,12 +38,24 @@ export class DiscoveredMCPTool extends BaseTool<ToolParams, ToolResult> {
name,
`${serverToolName} (${serverName} MCP Server)`,
description,
- parameterSchema,
+ { type: Type.OBJECT }, // this is a dummy Schema for MCP, will be not be used to construct the FunctionDeclaration
true, // isOutputMarkdown
false, // canUpdateOutput
);
}
+ /**
+ * Overrides the base schema to use parametersJsonSchema when building
+ * FunctionDeclaration
+ */
+ override get schema(): FunctionDeclaration {
+ return {
+ name: this.name,
+ description: this.description,
+ parametersJsonSchema: this.parameterSchemaJson,
+ };
+ }
+
async shouldConfirmExecute(
_params: ToolParams,
_abortSignal: AbortSignal,