feat: hide MCP list tools#60
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR updates the MCP integration so that mcp_list_tools is used strictly for internal orchestration (tool discovery) and is no longer emitted as streamed events or included in the final response.output. The demo UI is also adjusted to stop rendering MCP tool-list output.
Changes:
- Replace streaming
listMcpToolsStreamwith an internallistMcpToolsfunction that returns tool metadata without emitting response output/events. - Update server-side and integration tests to assert
mcp_list_toolsis not present in response output. - Remove demo-side rendering/types for MCP tool-list output items.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/responses.test.js | Updates assertions to ensure mcp_list_tools never appears in final outputs. |
| src/routes/responses/mcpStream.ts | Converts tool listing from a streamed output item to an internal-only async function. |
| src/routes/responses/mcpStream.test.ts | Updates tests for the new internal listMcpTools behavior. |
| src/routes/responses/innerStream.ts | Switches orchestration to call listMcpTools without emitting output items/events. |
| src/routes/responses/innerStream.test.ts | Updates MCP stream mocking to the new function name. |
| src/routes/responses/closeOutputItem.ts | Updates comment to reflect list-tools output is internal-only. |
| demo/lib/assistant.ts | Removes demo types/handling for mcp_list_tools output items. |
| demo/components/chat.tsx | Stops rendering MCP tool-list UI in the chat component. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -61,7 +54,7 @@ export interface McpApprovalRequestItem { | |||
| arguments?: string; | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
@copilot Remove it from the demo, importing *.ts is a bad practice anyway.
| (connectMcpServer as ReturnType<typeof vi.fn>).mockResolvedValue(mockClient); | ||
|
|
||
| const responseObject = createMockResponseObject(); | ||
| const events = await collectEvents(listMcpToolsStream(mcpTool, responseObject, traceContext, log)); | ||
| const types = events.map((e) => e.type); | ||
| const result = await listMcpTools(mcpTool, traceContext, log); | ||
|
|
||
| expect(types).toEqual([ | ||
| "response.output_item.added", | ||
| "response.mcp_list_tools.in_progress", | ||
| "response.mcp_list_tools.completed", | ||
| "response.output_item.done", | ||
| ]); | ||
| expect(types.filter((t) => t === "response.output_item.done")).toHaveLength(1); | ||
| expect(result).toMatchObject({ | ||
| type: "mcp_list_tools", | ||
| server_label: "test-server", | ||
| tools: [{ name: "search", input_schema: { type: "object" }, description: "Search tool" }], | ||
| }); | ||
| expect(responseObject.output).toEqual([]); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.