Skip to content

Commit e3c7f2c

Browse files
authored
fix: mcp server list highlighting (#1627)
1 parent 1bc5aba commit e3c7f2c

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

chat-client/src/client/mcpMynahUi.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe('McpMynahUi', () => {
101101

102102
// Verify the parameters
103103
const callArgs = (mynahUi.openDetailedList as sinon.SinonStub).firstCall.args[0]
104-
assert.strictEqual(callArgs.detailedList.selectable, true)
104+
assert.strictEqual(callArgs.detailedList.selectable, 'clickable')
105105
assert.strictEqual(callArgs.detailedList.textDirection, 'row')
106106
assert.strictEqual(callArgs.detailedList.header.title, 'Test Title')
107107
assert.strictEqual(callArgs.detailedList.header.description, 'Test Description')
@@ -246,20 +246,22 @@ describe('McpMynahUi', () => {
246246
sinon.assert.calledOnce(mockSheet.close)
247247

248248
// Test onItemSelect event
249-
const mockItem = {
249+
const mockSelectItem = {
250+
id: 'mcp-server-click',
250251
title: 'Server 1',
251252
actions: [{ id: 'open-mcp-server' }],
252253
} as DetailedListItem
253-
events.onItemSelect(mockItem)
254+
events.onItemSelect(mockSelectItem)
254255
sinon.assert.calledWith(messager.onMcpServerClick as sinon.SinonStub, 'open-mcp-server', 'Server 1')
255256

256257
// Test onItemClick event
257258
const mockClickItem = {
258259
id: 'mcp-server-click',
259260
title: 'Server 1',
261+
actions: [{ id: 'open-mcp-server' }],
260262
} as DetailedListItem
261263
events.onItemClick(mockClickItem)
262-
sinon.assert.calledWith(messager.onMcpServerClick as sinon.SinonStub, 'mcp-server-click')
264+
sinon.assert.calledWith(messager.onMcpServerClick as sinon.SinonStub, 'open-mcp-server', 'Server 1')
263265

264266
// Test onActionClick event
265267
const mockAction = { id: 'add-new-mcp' } as ChatItemButton

chat-client/src/client/mcpMynahUi.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export class McpMynahUi {
264264
this.isMcpServersListActive = true
265265
// Convert the ListMcpServersResult to the format expected by mynahUi.openDetailedList
266266
const detailedList: any = {
267-
selectable: true,
267+
selectable: 'clickable',
268268
textDirection: 'row',
269269
header: params.header
270270
? {
@@ -416,15 +416,16 @@ export class McpMynahUi {
416416
}
417417
},
418418
onItemSelect: (item: DetailedListItem) => {
419-
// actionId: open-mcp-server if valid server or mcp-fix-server if server needs to be fixed
420419
const actionId = item.actions?.[0].id
421420
if (actionId) {
422421
this.messager.onMcpServerClick(actionId, item.title)
423422
}
424423
},
425424
onItemClick: (item: DetailedListItem) => {
426-
if (item.id) {
427-
this.messager.onMcpServerClick(item.id)
425+
// actionId: open-mcp-server if valid server or mcp-fix-server if server needs to be fixed
426+
const actionId = item.actions?.[0].id
427+
if (actionId) {
428+
this.messager.onMcpServerClick(actionId, item.title)
428429
}
429430
},
430431
onActionClick: (action: ChatItemButton, item?: DetailedListItem) => {

0 commit comments

Comments
 (0)