Support Image Content Result#58
Conversation
… and audio content types with base64 encoding
…ndler chain for image and text responses
Reviewer's GuideThis PR refactors the content model to support text, image, and audio results via a Content interface, integrates a response handler chain for HTTP responses, and updates tool execution and streaming endpoints to work with the new mcp.CallToolResult structure. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @KamToHung - I've reviewed your changes - here's some feedback:
- In ImageHandler.Handle, populate ImageContent.MimeType using resp.Header.Get("Content-Type") so the client knows the actual MIME type instead of leaving it blank.
- Since you’ve defined AudioContent in the types, consider adding an AudioHandler in the ResponseHandlerChain to properly handle audio/* responses instead of falling back to the text handler.
- handler.go calls renderTemplate but never defines or imports it—either wire in the correct function from the template package (e.g., template.Render) or provide a local implementation.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…ndler chain for image and text responses
…ndler chain for image and text responses
|
PTAL |
ready for review? |
Yes, please take a look if it meet the requirements |
There was a problem hiding this comment.
are these funcs currently unused?
* force returning when text handler cannot handle the response.
|
@KamToHung I've just adjusted this PR a bit. feel free to take a look :) |
|
everything else looks good to me. let me know if you're okay, I'll merge it. |
I made some changes, please take a look~ |
LGTM! could you please resolve conflicts? i'll merge it after they're resolved. |
# Conflicts: # internal/core/tool.go
PTAL |
|
LGTM!Thanks! |
WIP
Summary by Sourcery
Add structured content support for tool responses, including images and audio, by introducing a Content interface and a chain of response handlers that produce unified CallToolResult objects instead of raw strings.
New Features:
Enhancements: