Repository navigation
MCP Schema and Kotlin Nullability Fixes for Spring Boot 3.5 #7289
Xu-Justin
started this conversation in
Show and tell
Replies: 1 comment
|
This is a practical compatibility layer for teams that cannot move to the Spring Boot 4 / Spring AI 2 line yet. The distinction between an optional input and an input that explicitly accepts For confidence in a schema patcher like this, I would add a small compatibility matrix and golden-schema tests that cover:
Publishing a before/after fixture per edge case in the documentation would also make this easier for a team to evaluate before introducing it into a server. Nice focused scope for a bridge library. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
For teams maintaining MCP servers on Spring Boot 3.5 and Spring AI 1.1.x, upgrading to Spring AI 2.x may not be feasible due to its Spring Boot 4 requirement.
I developed mcp-tool-schema-patcher to address two schema-generation issues in the standalone
mcp-annotations0.9.x provider while remaining on the existing stack.1. Input references
What is the issue?
Generated input schemas can place definitions under an individual parameter while referencing them from the schema root. For example,
#/$defs/Addresscannot resolve whenAddressis defined atproperties.customer.$defs.Address.ToolSchemaDefsPatchermoves these definitions to the root and updates affected references when names collide. It supports both Java and Kotlin tools.Sample usage
dependencies { implementation("io.github.xu-justin:mcp-tool-schema-patcher-core:0.1.0") }Before-and-after example and details
2. Kotlin nullability
What is the issue?
Kotlin nullable parameters and properties can appear in the generated schema's
requiredlist. Nullable output properties can also reject explicitnullvalues.ToolSchemaNullabilityPatchermakes nullable inputs optional and allows nullable output properties to acceptnullthroughanyOf. Java tools are returned unchanged. Optional inputs and explicit null values are distinct: this patcher does not add null types to input schemas.Sample usage
dependencies { implementation("io.github.xu-justin:mcp-tool-schema-patcher-kotlin:0.1.0") }The Kotlin module includes core. If both issues apply, pass the result of
ToolSchemaDefsPatcher.patch(...)intoToolSchemaNullabilityPatcher.patch(toolObjects, ...).Before-and-after example and limitations
Version 0.1.0 is available on Maven Central under
io.github.xu-justin. Requires Java 17+.This is an independent project. Feedback and compatibility reports from teams using this stack are welcome.
Source and documentation
All reactions