Skip to content

Commit a19d9b6

Browse files
committed
feat: add integration tests and post-processor for handling Flux return types in MCP tools
Signed-off-by: liugddx <[email protected]>
1 parent 0fdb911 commit a19d9b6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-common/src/main/java/org/springframework/ai/mcp/server/common/autoconfigure/annotations/StatelessServerSpecificationFactoryAutoConfiguration.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,12 @@ public List<McpStatelessServerFeatures.AsyncCompletionSpecification> completionS
127127
@Bean
128128
public List<McpStatelessServerFeatures.AsyncToolSpecification> toolSpecs(
129129
ServerMcpAnnotatedBeans beansWithMcpMethodAnnotations) {
130-
return AsyncMcpAnnotationProviders
131-
.statelessToolSpecifications(beansWithMcpMethodAnnotations.getBeansByAnnotation(McpTool.class));
130+
List<Object> toolBeans = beansWithMcpMethodAnnotations.getBeansByAnnotation(McpTool.class);
131+
List<McpStatelessServerFeatures.AsyncToolSpecification> originalSpecs = AsyncMcpAnnotationProviders
132+
.statelessToolSpecifications(toolBeans);
133+
134+
// Apply post-processing to handle Flux return types (Issue #4542)
135+
return FluxToolSpecificationPostProcessor.processToolSpecifications(originalSpecs, toolBeans);
132136
}
133137

134138
}

0 commit comments

Comments
 (0)