-
Notifications
You must be signed in to change notification settings - Fork 709
docs: use helper functions and return error as result #322
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
Conversation
Signed-off-by: Navendu Pottekkat <navendu@apache.org>
WalkthroughThe Changes
Suggested labels
Suggested reviewers
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🪛 LanguageToolREADME.md[grammar] ~100-~100: You’ve repeated a verb. Did you mean to only write one of them? (REPEATED_VERBS) 🪛 markdownlint-cli2 (0.17.2)README.md97-97: Unordered list style (MD004, ul-style) 98-98: Unordered list style (MD004, ul-style) 99-99: Unordered list style (MD004, ul-style) 100-100: Unordered list style (MD004, ul-style) 101-101: Unordered list style (MD004, ul-style) 102-102: Unordered list style (MD004, ul-style) 🔇 Additional comments (2)
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 (
|
name, ok := request.GetArguments()["name"].(string) | ||
if !ok { | ||
return nil, errors.New("name must be a string") | ||
name, err := request.RequireString("name") |
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.
Use the helper function. That's how we would want developers to use the SDK.
return nil, errors.New("name must be a string") | ||
name, err := request.RequireString("name") | ||
if err != nil { | ||
return mcp.NewToolResultError(err.Error()), nil |
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.
Errors should be returned in the result so that the MCP client/host/LLM can use it as feedback. We follow that in other examples and we should do that here too.
- [Prompts](#prompts) | ||
- [Examples](#examples) | ||
- [Extras](#extras) | ||
- [Transports](#transports) | ||
- [Session Management](#session-management) | ||
- [Basic Session Handling](#basic-session-handling) | ||
- [Per-Session Tools](#per-session-tools) | ||
- [Tool Filtering](#tool-filtering) | ||
- [Working with Context](#working-with-context) | ||
- [Request Hooks](#request-hooks) | ||
- [Tool Handler Middleware](#tool-handler-middleware) | ||
- [Regenerating Server Code](#regenerating-server-code) | ||
- [Contributing](/CONTRIBUTING.md) |
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.
Apparently the ToC was not up to date, my formatter automatically formatted it for me on save.
Description
I was checking for inconsistencies in the documentation with recent updates to the SDK. This was the only one I could find. The rest looks good.
Type of Change
Checklist
Summary by CodeRabbit