Repository navigation
Conversation
This was referenced Oct 19, 2026
This branch has not been deployed
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.
What this PR does:
MCP tool calls build a
CommandContext, which puts the request ID and schema names into the logging context (MDC), but nothing removes them when the call ends. The HTTP resources close the context on termination;McpResourcedoes not. Keyspace tools also build a secondRequestContextfor the command context, so one call starts under one request ID and runs under another.This PR makes the MCP path do what
GeneralResourcealready does:McpResource.processCommand()closes the command context withonTermination(), so it runs on success, on failure, when the MCP feature is disabled, and on cancellation. A failure while closing is logged and does not replace the tool result or the original error.McpResource.buildKeyspaceContext()passes theRequestContextit already created to the context builder instead of creating a second one. Database and collection/table calls already did this.Which issue(s) this PR fixes:
Part of #2629. Leaves #2629 open for the trace-context audit, see NOTE above.
Checklist