Adds the user's active file in the IDE to the footer (#4154)

This commit is contained in:
Shreya Keshive
2025-07-15 10:19:59 -04:00
committed by GitHub
parent 97cc1e6418
commit b09bc66560
7 changed files with 287 additions and 4 deletions

View File

@@ -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,