-
Notifications
You must be signed in to change notification settings - Fork 702
Add audio content #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add audio content #247
Conversation
WalkthroughA new audio content type is introduced for use with LLMs, including a corresponding Go struct and handler. The example application registers a new audio tool, updates its handler logic to return audio content, and changes the SSE server port. Minor code cleanups and type generalizations are also included. Changes
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
examples/everything/main.go(7 hunks)mcp/types.go(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
examples/everything/main.go (3)
mcp/tools.go (4)
NewTool(161-183)WithDescription(204-208)CallToolRequest(44-59)CallToolResult(34-41)mcp/prompts.go (2)
Role(68-68)RoleUser(71-71)mcp/types.go (5)
Content(684-686)AudioContent(714-721)AudioContent(723-723)TextContent(690-695)TextContent(697-697)
🔇 Additional comments (7)
mcp/types.go (1)
712-723: Well-structured implementation of the AudioContent typeThe AudioContent struct follows the same pattern as existing content types like TextContent and ImageContent, with appropriate JSON tags and field definitions. This ensures consistency throughout the codebase.
examples/everything/main.go (6)
22-22: LGTM: New audio tool constant addedThis constant follows the existing naming convention for tools.
157-159: LGTM: Tool registration follows established patternThe audio tool is registered consistently with other tools in the system.
286-293: LGTM: Audio content properly added to complex promptThe audio content is correctly integrated into the complex prompt handler, properly using the MCP_AUDIO constant as its data source.
384-384: Use of 'any' type alias improves code readabilityReplacing
interface{}withanyfollows modern Go conventions (introduced in Go 1.18) and improves code readability.
493-494: SSE server port changed from 8080 to 8081The SSE server now listens on port 8081 instead of 8080. Ensure this change is intentional and documented appropriately for users of the example.
504-507: LGTM: New MCP_AUDIO constant for minimal audio dataThe implementation adds a base64-encoded minimal audio data constant that can be used throughout the codebase, similar to the existing MCP_TINY_IMAGE constant.
To issues#243
mcp/types.goand the exmaple inexamples/everything/main.goAudio type as a responsee:
{ "type": "audio", "data": "base64-encoded-audio-data", "mimeType": "audio/wav" }Summary by CodeRabbit