Skip to content

Handle MCP tool setup failures - #2653

Open
erichare wants to merge 1 commit into
fix/mcp-request-context-cleanupfrom
fix/mcp-setup-errors
Open

erichare wants to merge 1 commit into
fix/mcp-request-context-cleanupfrom
fix/mcp-setup-errors

Conversation

@erichare

@erichare erichare commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does:

Defers MCP context setup and handles request, schema, and provider setup failures at one shared boundary. Known non-security Data API errors keep their codes and messages, while unexpected setup failures return a generic error. Authentication/security, protocol, cancellation, and processor failures keep their existing handling.

This builds on #2645. It no longer depends on #2652, so tool results keep empty text content and the tests check structuredContent and _meta instead.

Which issue(s) this PR fixes:

Fixes #2628. OAuth admission remains in #2642.

Verification

39 focused tests passed with 0 failures, 0 errors, and 0 skips on commit 81ed051ae. The formatter check also passed in the same invocation. McpSetupErrorsIntegrationTest passed 6 of 6 against a packaged build.

JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-21.jdk/Contents/Home ./mvnw -B -ntp test '-Dtest=McpSetupErrorsTest,McpResourceTest,CommandResultToToolResponseTest' -DskipITs -Dxml-format.skip=true
JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-21.jdk/Contents/Home ./mvnw -B -ntp verify -DskipUnitTests -Dit.test=McpSetupErrorsIntegrationTest -Dxml-format.skip=true

Manual client checks were not run.

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@erichare
erichare requested a review from a team as a code owner October 22, 2026 17:14
@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 55.07%
This PR 55.58%
Delta 🟢 +0.50%
✅ Coverage improved!

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Unit Test Coverage Report

Overall Project 55.58% -0.04% 🍏
Files changed 86.32% 🍏

File Coverage
McpResource.java 90.1% -9.9% 🍏

@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 73.04%
This PR 73.04%
Delta 🟢 +0.01%
✅ Coverage improved!

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Integration Test Coverage Report (dse69-it)

Overall Project 73.04% -0.05% 🍏
Files changed 81.75% 🍏

File Coverage
McpResource.java 85.14% -13.1% 🍏

@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.35%
This PR 74.35%
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.35% -0.05% 🍏
Files changed 81.75% 🍏

File Coverage
McpResource.java 85.14% -13.1% 🍏

Defer MCP context setup and handle request, schema, and provider setup failures at one shared boundary. Known non-security Data API errors keep their codes and messages. Unexpected setup failures return a generic error. Authentication, security, protocol, cancellation, and processor failures keep their existing handling.

Rebased onto fix/mcp-request-context-cleanup without the readable-results change. Tool results keep empty text content, so the tests check structuredContent and _meta instead.
@erichare
erichare force-pushed the fix/mcp-setup-errors branch from 71765e2 to 81ed051 Compare October 27, 2026 23:08
@erichare
erichare removed this pull request from stack #2660 October 27, 2026 23:11
@erichare
erichare changed the base branch from fix/mcp-readable-results to fix/mcp-request-context-cleanup October 27, 2026 23:11
@erichare
erichare added this pull request to stack #2667 October 27, 2026 23:12
@erichare erichare mentioned this pull request Oct 28, 2026
3 of 4 tasks

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.

MCP: Return useful errors when tool setup fails

1 participant