Repository navigation
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: I found a potential duplicate PR: PR #35662: fix(mcp): tolerate invalid output schema patterns This PR has the exact same title and appears to address the same issue as the current PR #35679. Both are fixing the handling of invalid MCP output schema patterns. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #35624
Type of change
What does this PR do?
Some MCP servers can return a tool
outputSchemawhosepatternis not valid in ECMAScript regex syntax. The MCP SDK validatestools/list, then precompiles output schema validators inClient.listTools(). When that precompile throws, OpenCode currently treats the whole tool discovery as failed.OpenCode already has a tolerant
tools/listretry path for output schema validation problems. This PR extends that same fallback to SDK errors caused by invalid output schema regex patterns, so the server can still connect and list tools while output-schema validation is skipped for that fallback response.How did you verify your code works?
(?P<workflow_id>...)in a tool output schema pattern. Before the fix,McpCatalog.defs()returnedundefinedfor the whole tool list.bun test --timeout 30000 test/mcp/catalog.test.tsbun test --timeout 30000 test/mcpbunx prettier --check packages/opencode/src/mcp/catalog.ts packages/opencode/test/mcp/catalog.test.tsbun run typecheckfrompackages/opencodebun run lintfrom the repo rootbun turbo typecheckScreenshots / recordings
Not a UI change.
Checklist