fix(core): clean up mcp event surface (#35221)

This commit is contained in:
Aiden Cline 2026-07-03 13:43:21 -05:00 committed by GitHub
commit bf3ae45439
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 28 additions and 36 deletions

View file

@ -0,0 +1,14 @@
import { describe, expect, test } from "bun:test"
import { MCP } from "@opencode-ai/core/mcp/index"
import { MCPClient } from "@opencode-ai/core/mcp/client"
describe("MCP errors", () => {
test("expose useful messages", () => {
expect(new MCP.NotFoundError({ server: MCP.ServerName.make("demo") }).message).toBe("MCP server not found: demo")
expect(new MCP.ToolCallError({ server: MCP.ServerName.make("demo"), tool: "search", message: "failed" }).message).toBe(
"failed",
)
expect(new MCPClient.NeedsAuthError({ server: "demo" }).message).toBe("MCP server requires authentication: demo")
expect(new MCPClient.ConnectError({ server: "demo", message: "offline" }).message).toBe("offline")
})
})