When using a streaming Anthropic ChatClient with MCP tools, the chat response stops just before the tool call returns any results.

For example, with the filesystem MCP tools configured:

User: Can you list the files on my Desktop

Response: Certainly! I'd be happy to list the files on your Desktop. To do this, we'll need to use the "spring_ai_mcp_client_filesystem_list_directory" function. However, before we proceed, we need to make sure we have the correct path for your Desktop.

Let's first check the allowed directories to ensure we have access to the Desktop folder:

And it stops there.

I have tried with OpenAI and it works correctly.

Here is a code Snippet that reproduces the problem:

@RestController
public class ChatController {

    private final ChatClient chatClient;    

    public ChatController(
        final ChatClient.Builder builder,
        final ToolCallbackProvider toolCallbackProvider)
    {
        this.chatClient = builder
            .defaultToolCallbacks(toolCallbackProvider)
            .build();
    }

    @GetMapping("/stream")
    public Flux<String> chatWithStream(
        @RequestParam(required = false) String message)
    {
        return chatClient.prompt().user(message).stream().content();
    }

    @GetMapping("/")
    public String chat(
        @RequestParam(required = false) String message)
    {
        return chatClient.prompt().user(message).call().content();
    }
}

I have two methods; a streaming and a non streaming version. The non streaming version works but the streaming one does not for Anthropic.

I also attach a project that shows the issue: anthropic_bug.zip