-
Notifications
You must be signed in to change notification settings - Fork 46
Add more and better examples #228
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
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. |
| // Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file | ||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE 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.
Maybe for these examples, it would be good to add a dartdoc comment at the top that describes what each example is meant to show and a pointer to the README.md. In general, for examples, these don't have enough comments.
It's also helpful when perusing the code in an IDE to have dartdoc links back to the classes that are relevant (e.g. to MCPServer and PromptsSupport for this one).
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.
I had Gemini add some comments and then cleaned them up a bit, also moved some things around to simplify it.
The version checking for instance doesn't need to happen manually (it is handled for you) and also things can be registered in the constructor instead of initialize which is more concise (no need to override and call super).
gspencergoog
left a comment
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.

Towards #220.
I also added a utility function for created stdio stream channels to simplify the examples (and real user code), and fixed a bug in the PromptMessage constructor.
Still missing a few examples, but this covers the most common use cases.
cc @gaaclarke