feat(mcp): add support for custom MIME types in tool responses

Add capability to specify MIME types for MCP tool responses, with special handling for image content.

This enhancement allows tools to return different content types, particularly images, by:
- Adding a new toolResponseMimeType map property to configure response MIME types per tool
- Extending tool registration methods to accept and use MIME type information
- Adding special handling for image content in tool responses
- Updating documentation with the new configuration options

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
Christian Tzolov
2025-03-01 19:41:19 +01:00
committed by Christian Tzolov
parent dcdfd7a72a
commit 53bb6a5b00
4 changed files with 117 additions and 9 deletions

View File

@@ -87,8 +87,9 @@ All properties are prefixed with `spring.ai.mcp.server`:
|`version` |Server version |`1.0.0`
|`type` |Server type (SYNC/ASYNC) |`SYNC`
|`resource-change-notification` |Enable resource change notifications |`true`
|`tool-change-notification` |Enable tool change notifications |`true`
|`prompt-change-notification` |Enable prompt change notifications |`true`
|`tool-change-notification` |Enable tool change notifications |`true`
|`tool-response-mime-type` |(optinal) response MIME type per tool name. For example `spring.ai.mcp.server.tool-response-mime-type.generateImage=image/png` will assosiate the `image/png` mime type with the `generateImage()` tool name |`-`
|`sse-message-endpoint` |SSE endpoint path for web transport |`/mcp/message`
|===