From b09bc6656080d4d12e1d06734aae2ec33af5c1ed Mon Sep 17 00:00:00 2001 From: Shreya Keshive Date: Tue, 15 Jul 2025 10:19:59 -0400 Subject: Adds the user's active file in the IDE to the footer (#4154) --- packages/core/src/tools/mcp-client.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'packages/core/src/tools/mcp-client.ts') diff --git a/packages/core/src/tools/mcp-client.ts b/packages/core/src/tools/mcp-client.ts index eb82190b..beb70549 100644 --- a/packages/core/src/tools/mcp-client.ts +++ b/packages/core/src/tools/mcp-client.ts @@ -20,6 +20,11 @@ import { MCPServerConfig } from '../config/config.js'; import { DiscoveredMCPTool } from './mcp-tool.js'; import { FunctionDeclaration, Type, mcpToTool } from '@google/genai'; import { sanitizeParameters, ToolRegistry } from './tool-registry.js'; +import { + ActiveFileNotificationSchema, + IDE_SERVER_NAME, + ideContext, +} from '../services/ideContext.js'; export const MCP_DEFAULT_TIMEOUT_MSEC = 10 * 60 * 1000; // default to 10 minutes @@ -211,6 +216,15 @@ export async function connectAndDiscover( updateMCPServerStatus(mcpServerName, MCPServerStatus.DISCONNECTED); }; + if (mcpServerName === IDE_SERVER_NAME) { + mcpClient.setNotificationHandler( + ActiveFileNotificationSchema, + (notification) => { + ideContext.setActiveFileContext(notification.params); + }, + ); + } + const tools = await discoverTools( mcpServerName, mcpServerConfig, -- cgit v1.2.3