fix(plugins): preserve virtual server context for tool calls - #6474
Open
Tethys0 wants to merge 1 commit into
Open
fix(plugins): preserve virtual server context for tool calls#6474Tethys0 wants to merge 1 commit into
Tethys0 wants to merge 1 commit into
Conversation
Signed-off-by: Bo Zhang <187063395+Tethys0@users.noreply.github.com>
Tethys0
requested review from
Lang-Akshay,
brian-hussey,
crivetimihai,
ja8zyjits and
msureshkumar88
as code owners
August 29, 2026 15:38
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
Fixes #6233.
Tool plugin
GlobalContext.server_idwas not reliable for virtual-server calls. The normal invocation fallback discarded the explicit virtual-server ID, while the existing-context path could overwrite it with the tool's gateway ID. That madePluginCondition.server_idsand custom server-scoped plugin logic silently miss every call routed through a virtual server.This patch:
server_idthrough both tool-context construction paths;Testing
uv run --frozen pytest -q tests/unit/mcpgateway/services/test_tool_service_tenant_id.py tests/unit/mcpgateway/services/test_tool_service_coverage.py- 383 passed, 1 skipped (intentional pre-existing coverage marker)uv run --frozen ruff check mcpgateway/services/tool_service.py tests/unit/mcpgateway/services/test_tool_service_tenant_id.py tests/unit/mcpgateway/services/test_tool_service_coverage.py- passeduv run --frozen ruff format --check mcpgateway/services/tool_service.py tests/unit/mcpgateway/services/test_tool_service_tenant_id.py tests/unit/mcpgateway/services/test_tool_service_coverage.py- passedgit diff --check- passedThe full
make testtarget was also started locally but did not complete within the available run window; no full-suite result is claimed here.