Skip to content

Call MCP error argument 'content' is null #3290

@checkHup

Description

@checkHup

Bug description
Call MCP error argument 'content' is null

Environment
1.0.0-M8

Steps to reproduce

java.lang.IllegalArgumentException: argument "content" is null
at com.fasterxml.jackson.databind.ObjectMapper._assertNotNull(ObjectMapper.java:5086) ~[jackson-databind-2.18.3.jar:2.18.3]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3850) ~[jackson-databind-2.18.3.jar:2.18.3]
at org.springframework.ai.model.ModelOptionsUtils.jsonToMap(ModelOptionsUtils.java:91) ~[spring-ai-model-1.0.0-M8.jar:1.0.0-M8]
at org.springframework.ai.mcp.AsyncMcpToolCallback.call(AsyncMcpToolCallback.java:108) ~[spring-ai-mcp-1.0.0-M8.jar:1.0.0-M8]
at org.springframework.ai.mcp.AsyncMcpToolCallback.call(AsyncMcpToolCallback.java:122) ~[spring-ai-mcp-1.0.0-M8.jar:1.0.0-M8]
at org.springframework.ai.model.tool.DefaultToolCallingManager.executeToolCall(DefaultToolCallingManager.java:205) ~[spring-ai-model-1.0.0-M8.jar:1.0.0-M8]
at org.springframework.ai.model.tool.DefaultToolCallingManager.executeToolCalls(DefaultToolCallingManager.java:128) ~[spring-ai-model-1.0.0-M8.jar:1.0.0-M8]
at org.springframework.ai.openai.OpenAiChatModel.lambda$internalStream$10(OpenAiChatModel.java:365) ~[spring-ai-openai-1.0.0-M8.jar:1.0.0-M8]

Expected behavior
I hope to return in the form of sse

Minimal Complete Reproducible example
client:
public Flux<ServerSentEvent> simpleChat(@RequestParam(value = "query", defaultValue = "hello")String query) {

    return dashScopeChatClient
            .prompt(query)
            .stream()
            .chatResponse()
            .map(data->{
                    String text=data.getResult().getOutput().getText();
                    return ServerSentEvent.builder()
                            .data(text)
                            .build();
            });
}

spring:
ai:
mcp:
client:
type: ASYNC
sse:
connections:
server1:
url: http://localhost:8081

server:
@tool(description = "serach all tables")
public String queryAllTables(){
String sql = "SELECT TABLE_NAME , TABLE_COMMENT FROM information_schema.tables WHERE TABLE_SCHEMA = DATABASE()";
return sql;
}

spring:
ai:
mcp:
server:
name: webflux-mcp-server
version: 1.0.0
stdio: false
type: ASYNC # Recommended for reactive applications

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions