Skip to content

fix: describe map and string-or-object MCP tool arguments correctly - #2682

Open
erichare wants to merge 1 commit into
mainfrom
fix/mcp-table-index-schemas
Open

erichare wants to merge 1 commit into
mainfrom
fix/mcp-table-index-schemas

Conversation

@erichare

@erichare erichare commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does:

Four MCP tool arguments had input schemas that describe JSON the server does not accept. The column and field maps of createTable, alterTable, createType, and alterType listed accessOrder, loadFactor, and threshold, which are private fields of LinkedHashMap. The column of createIndex, the primaryKey of createTable, and the lexical analyzer of createCollection were typed as objects only, though each also accepts a string.

McpSchemaCustomizer now describes a class that extends a map as a JSON object. It also reads anyOf and oneOf from a field's @Schema, which Swagger already reads. primaryKey and analyzer carried those annotations already, and RegularIndexDefinitionDesc.column gains one. The command parsing is unchanged.

Which issue(s) this PR fixes:
Part of #2604

Verification

McpSchemaShapeContractTest parses each example with the server's own deserializer and validates it against the published tool schema. Its table and index tests failed on main for the reasons above, and all 13 pass with the change. The command below ran 131 tests with no failures or skips on JDK 25. The QuarkusIntegrationTest schema suite was not run locally.

./mvnw -o -B -ntp test -DskipITs -Dfmt.skip=true -Dxml-format.skip=true \
  -Dsurefire.failIfNoSpecifiedTests=false -Dquarkus.http.test-port=19284 \
  '-Dtest=Mcp*Test,*OpenApi*Test,!*IntegrationTest'

One open question. The OpenAPI document still describes each table column type as an object with an apiName property. I left that alone because it changes the Swagger output and is not needed for the MCP schemas.

Checklist

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

Table columns were described by the private fields of LinkedHashMap. The
column of a regular index, a table primary key, and a collection's lexical
analyzer were described as objects only, though each also accepts a string.
@erichare
erichare requested a review from a team as a code owner November 19, 2026 22:44
@github-actions

Copy link
Copy Markdown
Contributor

📈 Unit Test Coverage Delta vs Main Branch

Metric Value
Main Branch 57.12%
This PR 57.21%
Delta 🟢 +0.09%
✅ Coverage improved!

@github-actions

Copy link
Copy Markdown
Contributor

Unit Test Coverage Report

Overall Project 57.21% 🍏
Files changed 100% 🍏

File Coverage
McpSchemaCustomizer.java 100% 🍏
RegularIndexDefinitionDesc.java 58.82% 🍏

@github-actions

Copy link
Copy Markdown
Contributor

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

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

@github-actions

Copy link
Copy Markdown
Contributor

Integration Test Coverage Report (dse69-it)

Overall Project 72.77% 🍏
Files changed 100% 🍏

File Coverage
RegularIndexDefinitionDesc.java 100% 🍏
McpSchemaCustomizer.java 98.05% 🍏

@github-actions

Copy link
Copy Markdown
Contributor

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

Metric Value
Main Branch 74.21%
This PR 74.23%
Delta 🟢 +0.02%
✅ Coverage improved!

@github-actions

Copy link
Copy Markdown
Contributor

Integration Test Coverage Report (hcd-it)

Overall Project 74.23% 🍏
Files changed 100% 🍏

File Coverage
RegularIndexDefinitionDesc.java 100% 🍏
McpSchemaCustomizer.java 98.05% 🍏

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