Updates schema, UX and prompt for IDE context (#5046)

This commit is contained in:
Shreya Keshive
2025-07-28 11:03:22 -04:00
committed by GitHub
parent f2e006179d
commit e275441651
10 changed files with 680 additions and 259 deletions

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { ideContext, OpenFilesNotificationSchema } from '../ide/ideContext.js';
import { ideContext, IdeContextNotificationSchema } from '../ide/ideContext.js';
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
@@ -77,20 +77,20 @@ export class IdeClient {
await this.client.connect(transport);
this.client.setNotificationHandler(
OpenFilesNotificationSchema,
IdeContextNotificationSchema,
(notification) => {
ideContext.setOpenFilesContext(notification.params);
ideContext.setIdeContext(notification.params);
},
);
this.client.onerror = (error) => {
logger.debug('IDE MCP client error:', error);
this.connectionStatus = IDEConnectionStatus.Disconnected;
ideContext.clearOpenFilesContext();
ideContext.clearIdeContext();
};
this.client.onclose = () => {
logger.debug('IDE MCP client connection closed.');
this.connectionStatus = IDEConnectionStatus.Disconnected;
ideContext.clearOpenFilesContext();
ideContext.clearIdeContext();
};
this.connectionStatus = IDEConnectionStatus.Connected;