Skip to content

Commit df788df

Browse files
authored
fix: DH-21945: Missing panel url and removed unused tool (#318)
DH-21945: - Fixed a bug where `panelUrlFormat` was undefined if passing DHE server URL to `listVariables` tool - Removed unused `setEditorConnection` tool ### Testing - Connect to qa-gplus and run ```py from deephaven import time_table simple_ticking = time_table("PT2S") ``` - Copy / paste the following prompt into Copilot chat ``` #listVariables explicitly pass https://qa-gplus-java17-cluster-infra-1.int.illumon.com:8000/ as connectionUrl. Tell me if panelUrlFormat is populated ```
1 parent f1e7f68 commit df788df

6 files changed

Lines changed: 69 additions & 319 deletions

File tree

src/mcp/McpServer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
createRemoveRemoteFileSourcesTool,
2727
createRunCodeFromUriTool,
2828
createRunCodeTool,
29-
createSetEditorConnectionTool,
3029
createShowOutputPanelTool,
3130
} from './tools';
3231
import { OutputChannelWithHistory, withResolvers } from '../util';
@@ -74,7 +73,6 @@ export class McpServer extends DisposableBase {
7473
this.registerTool(createRemoveRemoteFileSourcesTool());
7574
this.registerTool(createRunCodeFromUriTool(this));
7675
this.registerTool(createRunCodeTool(this));
77-
this.registerTool(createSetEditorConnectionTool(this));
7876
this.registerTool(createShowOutputPanelTool(this));
7977
}
8078

src/mcp/tools/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ export * from './getTableData';
1212
export * from './removeRemoteFileSources';
1313
export * from './runCode';
1414
export * from './runCodeFromUri';
15-
export * from './setEditorConnection';
1615
export * from './showOutputPanel';

src/mcp/tools/setEditorConnection.spec.ts

Lines changed: 0 additions & 217 deletions
This file was deleted.

src/mcp/tools/setEditorConnection.ts

Lines changed: 0 additions & 87 deletions
This file was deleted.

src/mcp/utils/serverUtils.spec.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,48 @@ describe('serverUtils', () => {
285285
serverManager
286286
);
287287
});
288+
289+
it('should use connection.serverUrl when DHE server URL differs from connection URL', async () => {
290+
const dheServerUrl = new URL('http://deephaven-server:8000');
291+
const workerUrl = new URL('http://deephaven-server:8000/worker/abc');
292+
const mockPanelUrlFormat = 'mock.panelUrlFormat';
293+
294+
const connectionWithDifferentUrl = createMockDhcService({
295+
serverUrl: workerUrl,
296+
});
297+
298+
const runningDheServerWithDifferentUrl = {
299+
url: dheServerUrl,
300+
type: 'DHE',
301+
isRunning: true,
302+
} as ServerState;
303+
304+
vi.mocked(serverManager.getServer).mockReturnValue(
305+
runningDheServerWithDifferentUrl
306+
);
307+
vi.mocked(serverManager.getConnections).mockReturnValue([
308+
connectionWithDifferentUrl,
309+
]);
310+
vi.mocked(getDhePanelUrlFormat).mockResolvedValue(mockPanelUrlFormat);
311+
312+
const result = await getFirstConnectionOrCreate({
313+
serverManager,
314+
connectionUrl: dheServerUrl,
315+
});
316+
317+
expect(result).toEqual({
318+
success: true,
319+
connection: connectionWithDifferentUrl,
320+
panelUrlFormat: mockPanelUrlFormat,
321+
});
322+
323+
// Should use connection.serverUrl (workerUrl), not the DHE server URL
324+
expect(getDhePanelUrlFormat).toHaveBeenCalledWith(
325+
dheServerUrl,
326+
workerUrl,
327+
serverManager
328+
);
329+
});
288330
});
289331
});
290332

0 commit comments

Comments
 (0)