summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/mcp-tool.ts
diff options
context:
space:
mode:
authorWanlin Du <[email protected]>2025-08-11 16:12:41 -0700
committerGitHub <[email protected]>2025-08-11 23:12:41 +0000
commitd9fb08c9da3d2e8c501ec9badb2e2bd79eb15b93 (patch)
tree7d07e1586b736c1b6c44e28828aa29205af335ac /packages/core/src/tools/mcp-tool.ts
parentf52d073dfbfa4d5091a74bf33ac1c66e51265247 (diff)
feat: migrate tools to use parametersJsonSchema. (#5330)
Diffstat (limited to 'packages/core/src/tools/mcp-tool.ts')
-rw-r--r--packages/core/src/tools/mcp-tool.ts26
1 files changed, 4 insertions, 22 deletions
diff --git a/packages/core/src/tools/mcp-tool.ts b/packages/core/src/tools/mcp-tool.ts
index 3dd62e2b..4b9a9818 100644
--- a/packages/core/src/tools/mcp-tool.ts
+++ b/packages/core/src/tools/mcp-tool.ts
@@ -12,13 +12,7 @@ import {
ToolMcpConfirmationDetails,
Icon,
} from './tools.js';
-import {
- CallableTool,
- Part,
- FunctionCall,
- FunctionDeclaration,
- Type,
-} from '@google/genai';
+import { CallableTool, Part, FunctionCall } from '@google/genai';
type ToolParams = Record<string, unknown>;
@@ -64,7 +58,7 @@ export class DiscoveredMCPTool extends BaseTool<ToolParams, ToolResult> {
readonly serverName: string,
readonly serverToolName: string,
description: string,
- readonly parameterSchemaJson: unknown,
+ readonly parameterSchema: unknown,
readonly timeout?: number,
readonly trust?: boolean,
nameOverride?: string,
@@ -74,7 +68,7 @@ export class DiscoveredMCPTool extends BaseTool<ToolParams, ToolResult> {
`${serverToolName} (${serverName} MCP Server)`,
description,
Icon.Hammer,
- { type: Type.OBJECT }, // this is a dummy Schema for MCP, will be not be used to construct the FunctionDeclaration
+ parameterSchema,
true, // isOutputMarkdown
false, // canUpdateOutput
);
@@ -86,25 +80,13 @@ export class DiscoveredMCPTool extends BaseTool<ToolParams, ToolResult> {
this.serverName,
this.serverToolName,
this.description,
- this.parameterSchemaJson,
+ this.parameterSchema,
this.timeout,
this.trust,
`${this.serverName}__${this.serverToolName}`,
);
}
- /**
- * 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,