Skip to content

fix: MCP server issues in testing#2503

Draft
erichare wants to merge 2 commits into
mainfrom
fix/mcp-quirks
Draft

fix: MCP server issues in testing#2503
erichare wants to merge 2 commits into
mainfrom
fix/mcp-quirks

Conversation

@erichare

@erichare erichare commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What this PR does:

Fixes two bugs in the dev MCP server (/v1/mcp) affecting LLM/MCP clients:

  1. Tool results missing from content: CommandResult.toToolResponse() returned an empty content list, putting results only in _meta/structuredContent, which standard MCP clients don't read. Status-only commands (findKeyspaces, insertMany, …) appeared empty to the LLM. The full {data, status, errors} envelope is now also serialized as a text part in content.

  2. Advertised filter schema didn't match the accepted wire format: the tools/list inputSchema leaked internal Java fields (filterClause/json, etc.) for FilterDefinition, SortDefinition, UpdateClause, and FindAndRerankSort. New McpClauseSchemaCustomizer advertises these as plain objects with a description and example of the Data API syntax; @ToolArg descriptions updated to match.

Also converts failures that previously surfaced as opaque JSON-RPC -32603 errors (e.g. context-building failures) into proper isError tool responses with a message, so agents can self-correct.

Testing: new/updated unit tests (McpClauseSchemaCustomizerTest, CommandResultToToolResponseTest) and integration tests (non-empty content for findKeyspaces; find succeeds with the filter example taken verbatim from the advertised schema; invalid filter returns a tool error). All 57 MCP ITs and the full unit suite pass.

Which issue(s) this PR fixes:
Fixes #

Checklist

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

@github-actions

Copy link
Copy Markdown
Contributor

📈 Unit Test Coverage Delta vs Main Branch

Metric Value
Main Branch 52.50%
This PR 52.53%
Delta 🟢 +0.03%
✅ Coverage improved!

@github-actions

Copy link
Copy Markdown
Contributor

Unit Test Coverage Report

Overall Project 52.53% -0.14% 🍏
Files changed 48.44%

File Coverage
McpClauseSchemaCustomizer.java 97.62% -2.38% 🍏
CommandResult.java 78.92% -10.24%
CollectionCommandTools.java 0% 🍏
McpResource.java 0% -39.09%

@github-actions

Copy link
Copy Markdown
Contributor

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

Metric Value
Main Branch 72.50%
This PR 72.55%
Delta 🟢 +0.05%
✅ Coverage improved!

@github-actions

Copy link
Copy Markdown
Contributor

Integration Test Coverage Report (dse69-it)

Overall Project 72.55% -0.03% 🍏
Files changed 89.62% 🍏

File Coverage
CollectionCommandTools.java 100% 🍏
McpClauseSchemaCustomizer.java 94.44% -5.56% 🍏
McpResource.java 90.69% -1.8% 🍏
CommandResult.java 88.55% -10.24%

@github-actions

Copy link
Copy Markdown
Contributor

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

Metric Value
Main Branch 73.84%
This PR 73.89%
Delta 🟢 +0.05%
✅ Coverage improved!

@github-actions

Copy link
Copy Markdown
Contributor

Integration Test Coverage Report (hcd-it)

Overall Project 73.89% -0.03% 🍏
Files changed 89.62% 🍏

File Coverage
CollectionCommandTools.java 100% 🍏
McpClauseSchemaCustomizer.java 94.44% -5.56% 🍏
McpResource.java 90.69% -1.8% 🍏
CommandResult.java 88.55% -10.24%

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