Skip to content

Support generic output schemas in async MCP tool providers - #6791

Open
wxggzz wants to merge 1 commit into
spring-projects:mainfrom
wxggzz:codex/fix-async-mcp-generic-output-schema
Open

Support generic output schemas in async MCP tool providers#6791
wxggzz wants to merge 1 commit into
spring-projects:mainfrom
wxggzz:codex/fix-async-mcp-generic-output-schema

Conversation

@wxggzz

@wxggzz wxggzz commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Generate MCP output schemas for parameterized reactive return types in both stateful and stateless async tool providers.

When an @McpTool(generateOutputSchema = true) method returns a type such as Mono<List<Result>>, the reactive payload is a ParameterizedType. Both async providers converted non-Class<?> payloads to null before calling ClassUtils, causing tool registration to fail with IllegalArgumentException: Class must not be null.

This change:

  • preserves the existing primitive and simple-value filtering for class payloads;
  • generates schemas from ParameterizedType payloads;
  • covers both stateful and stateless async providers;
  • verifies the generated array schema and the structured tool result.

This supersedes and extends #5920 by covering both async provider variants and adding end-to-end structured-content assertions.

Testing

  • ./mvnw -Dmaven.build.cache.enabled=false -pl mcp/mcp-annotations -am test (1,378 tests, 0 failures, 2 skipped)
  • ./mvnw clean package (169 reactor modules, BUILD SUCCESS)

Signed-off-by: wxggzz <weixiegen0506@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants