• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 18939174065

30 Oct 2025 11:30AM UTC coverage: 47.68% (+0.4%) from 47.277%
18939174065

push

github

web-flow
Implement tool conflict resolution for Virtual MCP Server (#2365)

* Implement tool conflict resolution for Virtual MCP Server

Add three conflict resolution strategies (prefix, priority, manual) to handle
duplicate tool names across multiple backend MCP servers in vMCP aggregation.

This implements the aggregation conflict resolution portion of the Virtual MCP
Server proposal (THV-2106), enabling vMCP to merge capabilities from multiple
backends while resolving naming conflicts.

Key features:
- Prefix strategy: automatically prefixes tools with workload identifier
  (supports {workload}_, {workload}., custom formats)
- Priority strategy: explicit ordering with first-wins semantics
  (drops lower-priority conflicting tools with warnings)
- Manual strategy: requires explicit overrides with startup validation
  (fails if any conflicts lack overrides, safest for production)
- Reuses existing mcp.WithToolsFilter/Override middleware logic
- Per-backend tool filtering and overrides applied before conflict resolution
- Tracks conflict metadata (count resolved, strategy used)

Implementation:
- Extracted shared filtering/override logic from pkg/mcp/tool_filter.go
- Created applyFilteringAndOverrides() as single source of truth
- Both HTTP middleware and aggregator use the same battle-tested code
- Updated defaultAggregator to integrate conflict resolver
- Comprehensive table-driven unit tests for all strategies

This follows DDD principles with clear bounded contexts and maintains
backward compatibility with existing middleware behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address review comments on tool conflict resolution

- Add nil check in tool_adapter.go to prevent panic when tool not found in originalToolsByName map
- Add comment explaining O(n²) complexity is acceptable for small tool lists
- Improve warning message when priority strategy drops tools from backends not in pr... (continued)

417 of 464 new or added lines in 7 files covered. (89.87%)

5 existing lines in 2 files now uncovered.

20158 of 42278 relevant lines covered (47.68%)

22.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.62
/pkg/transport/proxy/httpsse/http_proxy.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc