fix(decopilot): allow direct tool calls in gateway modes with activeT…#2502
Merged
pedrofrxncx merged 1 commit intomainfrom Feb 26, 2026
Merged
Conversation
…ools filtering Always create a passthrough client to expose all real tools. In smart_tool_selection and code_execution modes, also create a strategy client for gateway meta-tools. Register all tools with streamText but use activeTools to hide passthrough tools from the LLM. This prevents AI SDK errors when the model attempts to directly call a discovered tool instead of routing through GATEWAY_CALL_TOOL.
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
Release OptionsShould a new version be published when this PR is merged? React with an emoji to vote on the release type:
Current version: Deployment
|
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.
Summary
smart_tool_selectionandcode_executionmodes, also create a strategy client for gateway meta-toolsstreamTextbut filter visibility viaactiveToolsMotivation
Previously, when the model used smart tool selection or code execution mode and discovered a tool (e.g., XPTO) via GATEWAY_SEARCH_TOOLS, it would sometimes attempt to call XPTO directly instead of routing through GATEWAY_CALL_TOOL. Since XPTO was not registered as a tool in streamText, the AI SDK would throw an error.
Implementation
The approach uses AI SDK's
activeToolsfield: tools exist and are callable, but their schemas are not shown to the LLM, allowing direct calls without errors while maintaining the intended gateway routing pattern.Testing
Notes
Summary by cubic
Fixes tool discovery errors in decopilot gateway modes. Registers all real tools and hides them with activeTools so direct tool calls work without SDK errors, while keeping gateway routing.
Written for commit 96b21f8. Summary will update on new commits.