Skip to content

fix: close the MCP command context when a tool call ends - #2645

Open
erichare wants to merge 2 commits into
mainfrom
fix/mcp-request-context-cleanup
Open

erichare wants to merge 2 commits into
mainfrom
fix/mcp-request-context-cleanup

Conversation

@erichare

@erichare erichare commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does:

Closes the command context when an MCP tool call succeeds, fails, or is canceled. Keyspace tools reuse the original request context. A cleanup failure preserves the command’s result or error.

Which issue(s) this PR fixes:

Part of #2629. Targets main and is the base for #2653. Full stack.

Verification

9 focused Java tests passed on JDK 25 at 39bf2fdbb. The same nine tests previously failed against the implementation on main. GitHub checks.

./mvnw -o -B -ntp clean test \
  -DskipITs -Dfmt.skip=true -Dxml-format.skip=true -Dsurefire.failIfNoSpecifiedTests=false \
  -Dquarkus.http.test-port=19281 -Dtest=McpResourceTest

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated (not needed for this change)
  • CLA Signed: DataStax CLA

@erichare
erichare requested a review from a team as a code owner October 13, 2026 21:15
@erichare
erichare changed the base branch from fix/mcp-protocol-foundation to fix/mcp-update-wire-schema October 22, 2026 18:19
@erichare erichare mentioned this pull request Oct 22, 2026
3 of 4 tasks
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

📈 Unit Test Coverage Delta vs Main Branch

Metric Value
Main Branch 57.12%
This PR 57.34%
Delta 🟢 +0.21%
✅ Coverage improved!

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Unit Test Coverage Report

Overall Project 57.34% 🍏
Files changed 100% 🍏

File Coverage
McpResource.java 50.32% 🍏

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

📈 Integration Test Coverage Delta vs Main Branch (dse69-it)

Metric Value
Main Branch 72.75%
This PR 72.75%
Delta 🟢 +0.00%
✅ Coverage improved!

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Integration Test Coverage Report (dse69-it)

Overall Project 72.75% -0.01% 🍏
Files changed 77.42% 🍏

File Coverage
McpResource.java 86.17% -2.25% 🍏

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

📉 Integration Test Coverage Delta vs Main Branch (hcd-it)

Metric Value
Main Branch 74.21%
This PR 74.21%
Delta 🔴 -0.00%
⚠️ Coverage decreased

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Integration Test Coverage Report (hcd-it)

Overall Project 74.21% -0.01% 🍏
Files changed 77.42% 🍏

File Coverage
McpResource.java 86.17% -2.25% 🍏

@erichare
erichare added this pull request to stack #2660 October 23, 2026 22:14
@erichare
erichare force-pushed the fix/mcp-request-context-cleanup branch from f8b0f28 to cca3d08 Compare October 24, 2026 00:36
@erichare
erichare removed this pull request from stack #2660 October 27, 2026 23:11
@erichare
erichare added this pull request to stack #2667 October 27, 2026 23:12
@erichare
erichare removed this pull request from stack #2667 November 5, 2026 19:26
@erichare
erichare force-pushed the fix/mcp-request-context-cleanup branch from cca3d08 to ef01113 Compare November 5, 2026 19:28
@erichare erichare changed the title MCP: close the command context when a tool call ends fix: close the MCP command context when a tool call ends Nov 5, 2026
@erichare
erichare changed the base branch from fix/mcp-update-wire-schema to fix/mcp-tool-argument-descriptions November 5, 2026 19:29
@erichare
erichare force-pushed the fix/mcp-request-context-cleanup branch from e1ec364 to ba69d1c Compare November 19, 2026 05:41
@erichare
erichare requested a review from amorton November 19, 2026 05:51
Share the command, context, and tool call across tests, build the
resource in one factory, and explain the less obvious cases.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant