Coerce types for non-advertised backend tools in composite workflows#4671
Open
Coerce types for non-advertised backend tools in composite workflows#4671
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes composite workflow argument type coercion for backend tools that are not advertised to MCP clients (excluded via excludeAll / filter) by ensuring the workflow engine can still access those tools’ InputSchema.
Changes:
- Split aggregator pre-queried capability processing into
advertisedTools(client-visible) andallResolvedTools(internal schema lookup). - Extended
MultiSessionwithAllTools()and stored both advertised vs all-resolved tool lists on the session. - Built the per-session composite workflow engine using
sess.AllTools()so schema-based coercion works even for hidden tools.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/vmcp/session/types/session.go | Adds AllTools() to the MultiSession interface and clarifies Tools() semantics. |
| pkg/vmcp/session/types/mocks/mock_session.go | Updates GoMock session mock to implement AllTools(). |
| pkg/vmcp/session/factory.go | Propagates both advertised and all-resolved tool lists into constructed sessions. |
| pkg/vmcp/session/default_session.go | Stores and exposes allTools via new AllTools() snapshot accessor. |
| pkg/vmcp/server/sessionmanager/factory.go | Builds per-session workflow composer using sess.AllTools() for schema lookup. |
| pkg/vmcp/server/telemetry_integration_test.go | Updates test session stub to satisfy the extended interface. |
| pkg/vmcp/server/session_management_integration_test.go | Updates session mocks/expectations for the new method. |
| pkg/vmcp/aggregator/aggregator.go | Updates the Aggregator interface to return both advertised and all-resolved tools. |
| pkg/vmcp/aggregator/default_aggregator.go | Returns advertisedTools + allResolvedTools while keeping routing table complete. |
| pkg/vmcp/aggregator/mocks/mock_interfaces.go | Updates GoMock aggregator mock for the new signature. |
| pkg/vmcp/aggregator/default_aggregator_test.go | Adjusts tests for the updated return signature (currently ignoring new value). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4671 +/- ##
==========================================
+ Coverage 68.85% 68.90% +0.05%
==========================================
Files 508 508
Lines 52604 52676 +72
==========================================
+ Hits 36220 36299 +79
+ Misses 13586 13574 -12
- Partials 2798 2803 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When backend tools are excluded from advertising via `excludeAll` or `filter`, the workflow engine could not find their `InputSchema` for argument type coercion. This caused string arguments (e.g. "42") to be forwarded to the backend as-is instead of being coerced to the correct type (e.g. float64(42)), resulting in backend rejection. Root cause: `ProcessPreQueriedCapabilities` only returned the advertised tool list. Sessions stored only those tools, and the workflow engine used `sess.Tools()` for schema lookup — so hidden tools were invisible to it. Fix: - `ProcessPreQueriedCapabilities` now returns both `advertisedTools` (filtered, for MCP clients) and `allResolvedTools` (every resolved tool regardless of filter, for internal schema lookup). - `MultiSession` gains `AllTools() []vmcp.Tool`, backed by the new `allTools` field on `defaultMultiSession`. - The per-session workflow engine is built from `sess.AllTools()` so it can coerce arguments for any backend tool, whether advertised or not. Fixes #4287
jerm-dro
approved these changes
Apr 8, 2026
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
When backend tools are excluded from advertising via
excludeAllorfilter, the workflow engine could not find theirInputSchemafor argument type coercion. This caused string arguments (e.g. "42") to be forwarded to the backend as-is instead of being coerced to the correct type (e.g. float64(42)), resulting in backend rejection.Root cause:
ProcessPreQueriedCapabilitiesonly returned the advertised tool list. Sessions stored only those tools, and the workflow engine usedsess.Tools()for schema lookup — so hidden tools were invisible to it.Fix:
ProcessPreQueriedCapabilitiesnow returns bothadvertisedTools(filtered, for MCP clients) andallResolvedTools(every resolved tool regardless of filter, for internal schema lookup).MultiSessiongainsAllTools() []vmcp.Tool, backed by the newallToolsfield ondefaultMultiSession.sess.AllTools()so it can coerce arguments for any backend tool, whether advertised or not.Fixes #4287
Type of change
Test plan
task test)task test-e2e)task lint-fix)Changes
Does this introduce a user-facing change?
Special notes for reviewers