Skip to content

fix(#3636): allow composite tools to use filtered backend tools - #3637

Merged
JAORMX merged 2 commits into
mainfrom
jerm/2026-02-05-fix-3636
Feb 6, 2026
Merged

JAORMX merged 2 commits into
mainfrom
jerm/2026-02-05-fix-3636

Conversation

@jerm-dro

@jerm-dro jerm-dro commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes issue #3636 where tools filtered via aggregation.tools[].filter could not be used in composite tool steps. The fix ensures that Filter behaves consistently with ExcludeAll - both hide tools from MCP clients while preserving them in the internal routing table for composite tool workflows.

Root Cause: The Filter configuration was applied in processBackendTools during capability discovery, which removed filtered tools from the pipeline entirely. This meant they never reached the routing table. In contrast, ExcludeAll was correctly applied later in MergeCapabilities, preserving tools in the routing table while hiding them from clients.

Fix: Move Filter logic to be applied in shouldAdvertiseTool (alongside ExcludeAll), ensuring filtered tools remain available for composite tool routing.

Changes

Core Fix

  • pkg/vmcp/aggregator/tool_adapter.go: Modified processBackendTools to only apply Overrides, not Filter
  • pkg/vmcp/aggregator/default_aggregator.go: Updated shouldAdvertiseTool to check Filter configuration in addition to ExcludeAll

Tests

  • pkg/vmcp/aggregator/default_aggregator_test.go: Added unit tests for Filter behavior including partial matches and precedence with global ExcludeAllTools
  • pkg/vmcp/aggregator/tool_adapter_test.go: Updated tests to reflect that Filter is no longer applied in processBackendTools
  • test/e2e/.../virtualmcp_composite_hidden_tools_test.go: New E2E test that creates two backends (one with ExcludeAll, one with Filter) and verifies a composite tool can use hidden tools from both

Documentation

  • pkg/vmcp/config/config.go: Enhanced documentation for ExcludeAllTools, ExcludeAll, and Filter fields to clarify visibility vs routing semantics
  • Updated terminology from "LLM" to "MCP client" for accuracy
  • Regenerated CRDs with updated field descriptions

Test Plan

  • Unit tests pass (go test ./pkg/vmcp/aggregator/...)
  • E2E test passes with two backends using different hiding mechanisms
  • Verified composite tool successfully calls tools from both ExcludeAll and Filter backends
  • Verified only the composite tool is exposed to clients (backend tools hidden)

Fixes #3636

Previously, using `filter` in aggregation.tools config would remove
backend tools from the routing table entirely, preventing composite
tools from calling them. This was inconsistent with `excludeAll` which
correctly kept tools in the routing table while hiding them from clients.

This fix moves Filter logic to be applied alongside ExcludeAll in
MergeCapabilities (via shouldAdvertiseTool), ensuring filtered tools
remain in the routing table for composite tool workflows.

Changes:
- Modified processBackendTools to only apply Overrides, not Filter
- Updated shouldAdvertiseTool to check Filter configuration
- Added comprehensive unit tests for Filter behavior
- Added combined E2E test with ExcludeAll and Filter on separate backends
- Updated documentation to clarify visibility vs routing semantics
- Changed terminology from "LLM" to "MCP client" for accuracy

Fixes: #3636
@github-actions github-actions Bot added the size/L Large PR: 600-999 lines changed label Feb 5, 2026
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
@github-actions github-actions Bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Feb 5, 2026
@jerm-dro
jerm-dro marked this pull request as ready for review February 5, 2026 22:55
@codecov

codecov Bot commented Feb 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.74%. Comparing base (788057b) to head (1e7cb08).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3637      +/-   ##
==========================================
- Coverage   65.75%   65.74%   -0.01%     
==========================================
  Files         411      411              
  Lines       40805    40811       +6     
==========================================
  Hits        26833    26833              
- Misses      11882    11886       +4     
- Partials     2090     2092       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JAORMX
JAORMX merged commit dad2bb8 into main Feb 6, 2026
46 of 47 checks passed
@JAORMX
JAORMX deleted the jerm/2026-02-05-fix-3636 branch February 6, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filtered tools cannot be used in vMCP composite tool steps

2 participants