Skip to content

fix(mcp): tolerate output schema ref failures#26614

Merged
kitlangton merged 3 commits intodevfrom
fix/mcp-output-schema-fallback-clean
May 10, 2026
Merged

fix(mcp): tolerate output schema ref failures#26614
kitlangton merged 3 commits intodevfrom
fix/mcp-output-schema-fallback-clean

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #26529
Closes #26260
Closes #26382

Based on the approach from #26530 by @nicolascancino, with cleanup and additional regression coverage.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Keeps the normal MCP SDK listTools() path for tool discovery. If that path fails with an output-schema/reference validation error, retries raw tools/list with a tolerant result schema that preserves inputSchema while treating outputSchema as opaque.

This prevents one invalid or unresolved MCP tool output schema from marking the entire server as failed, while still preserving normal behavior for transport/auth/listTools failures.

How did you verify your code works?

cd packages/opencode
bun test test/mcp/lifecycle.test.ts --timeout 30000
bun typecheck

Also ran:

bunx prettier --write src/mcp/index.ts test/mcp/lifecycle.test.ts
bunx oxlint packages/opencode/src/mcp/index.ts packages/opencode/test/mcp/lifecycle.test.ts

oxlint reported existing warnings in these files and no errors.

The pre-push hook also ran full workspace typecheck successfully.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@kitlangton kitlangton merged commit 79d6b10 into dev May 10, 2026
10 checks passed
@kitlangton kitlangton deleted the fix/mcp-output-schema-fallback-clean branch May 10, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant