Skip to content

MCP: describe accepted update syntax in tool schemas - #2651

Open
erichare wants to merge 51 commits into
mainfrom
fix/mcp-update-wire-schema
Open

erichare wants to merge 51 commits into
mainfrom
fix/mcp-update-wire-schema

Conversation

@erichare

@erichare erichare commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does:

Describes the twelve supported update operators in the shared UpdateClause schema. The enum and schema use the same wire-name constants. Contract tests check accepted payloads, and packaged tools/list tests cover all three update tools.

This builds on #2619.

Which issue(s) this PR fixes:

Fixes #2631.

Verification

All 115 focused tests passed with no failures, errors, or skips on commit c211c20.

JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-21.jdk/Contents/Home ./mvnw -B -ntp test '-Dtest=McpUpdateSchemaContractTest,McpOpenApiSchemaAdapterTest' -DskipITs -Dxml-format.skip=true

Packaged integration tests and manual client checks were not run in this verification.

Checklist

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

RED: schema contract tests compile and execute on Java 21, with seven schema failures and one malformed OpenAPI example error.
GREEN: 124 MCP schema, parser, builder, and ObjectMapper tests pass on Java 21. Schema examples validate and deserialize, and rerank override fields remain scoped to the request.
Align the HTTP and MCP hybrid descriptions. All 124 targeted tests, formatting, and the packaged build pass on Java 21.
RED: McpProtocolTest executes against MCP 1.13.0 and fails because the first tools/list POST returns HTTP 400 instead of 200.
GREEN: the same raw HTTP McpProtocolTest passes with MCP BOM 2.0.3 on Quarkus 3.38.1 and JDK 21. Both independent tools/list requests return complete results without Mcp-Session-Id.
Both DSE and HCD CI exposed four obsolete empty-metadata assertions after the framework upgrade. Require only serverInfo and validate its name and version. The two affected DSE integration classes pass locally: 17 tests, zero failures.
@erichare
erichare requested a review from a team as a code owner October 20, 2026 19:56
@erichare
erichare force-pushed the fix/mcp-update-wire-schema branch from 231ab04 to 0405aa0 Compare October 21, 2026 18:51
Use the reviewer's filter and sort descriptions, drop trailing sentences from schema descriptions, align example text blocks, restore the JsonDefinition field comment, rename SCHEMA_MAPS to SCHEMA_OBJECTS, use isBlank for annotation strings, and note that McpSchemaCustomizer absorbed McpSchemaDescriptionCustomizer.
Replace @Schema(hidden) with @JsonIgnore on clause wrapper state, restore Map.class on FindAndRerankSort, explain why HybridLimits sets implementation = Void.class, document the schema-only classes, nest the hybrid limit values schema inside HybridLimits, and explain each McpSchemaCustomizer block. The generated OpenAPI document is unchanged.
Address review feedback on McpOpenApiSchemaAdapter.

- Inject the delegate through the constructor and read the generated
  OpenAPI document there. A missing document now stops startup instead
  of failing tools/list requests, and the synchronized lazy loader is
  gone.
- Replace adapt() with static bundleOpenApiSchemas(), which changes the
  given schema in place. This drops the input deepCopy, and
  copyReferencedSchemas() returns its copies instead of filling a
  parameter.
- Convert the bundled tree straight to the Vert.x object the MCP library
  sends, removing the second JSON text round trip.
- Add OpenApiConstants.Components for the components/schemas pointer and
  ref prefix, plus componentRef() and named JSON Pointer escape helpers
  shared with McpSchemaCustomizer.
- Document the class, @priority, the $defs prefix, the schema keyword
  sets, and the argument pointer fix.
Bring the findAndRerank tool arguments to one standard, following
review feedback.

- filter now takes its description from FilterDefinition, as sort
  already does from FindAndRerankSort. A @ToolArg description replaces
  the class description, so it was showing only "filter".
- projection and options get real descriptions in place of "projection"
  and "Reranking options".
- collection says "Name of the collection", since findAndRerank has no
  table support.

Add contract tests that the filter description comes from its class and
that no argument is described only by its own name.
Apply the findAndRerank argument standard to all MCP tools, following
review feedback.

- filter and sort arguments take their descriptions from FilterDefinition
  and SortDefinition, which Swagger also uses. A @ToolArg description
  replaced them, so clients saw only "filter" or "sort".
- Collection arguments name what the command supports: the collection,
  the table, or a collection or table, based on CommandName targets.
- Projection, update, replacement, document, definition, and options
  arguments get real descriptions in place of their bare names or
  generic text.
- Descriptions drop "Optional" and "Required" prefixes, since the schema
  already lists required arguments, and use consistent capitalization.

Generalize the contract tests to every tool: filter and sort use their
class descriptions, and no argument is described only by its name or
starts with "Optional" or "Required".
…chema

# Conflicts:
#	src/test/java/io/stargate/sgv2/jsonapi/api/v1/mcp/McpHttpTestSupport.java
#	src/test/java/io/stargate/sgv2/jsonapi/api/v1/mcp/McpIntegrationTestBase.java
#	src/test/java/io/stargate/sgv2/jsonapi/api/v1/mcp/McpOpenApiSchemaAdapterTest.java
#	src/test/java/io/stargate/sgv2/jsonapi/api/v1/mcp/McpProtocolTest.java
#	src/test/java/io/stargate/sgv2/jsonapi/api/v1/mcp/McpSchemaIntegrationTest.java

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: Show valid update syntax in tool schemas

1 participant