feat(McpSchema): Add constructor to CallToolResult with one String entry#87
Closed
denniskawurek wants to merge 1 commit intomodelcontextprotocol:mainfrom
Closed
Conversation
He-Pin
reviewed
Apr 1, 2025
| List.of(new TextContent(content)), | ||
| isError | ||
| ); | ||
| } |
Contributor
There was a problem hiding this comment.
how about another success and failed one?
Contributor
|
Thanks you @denniskawurek ! Will review it over the weekend |
tzolov
added a commit
that referenced
this pull request
Apr 5, 2025
…ments (#87) - Add constructor to CallToolResult with one String entry - Add a new constructor to CallToolRequest that accepts JSON string arguments - Implement a builder pattern for CallToolResult with methods for adding content items - Add test coverage for new functionality Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com> Co-authored-by: Christian Tzolov <christian.tzolov@broadcom.com>
Contributor
|
Thank you @denniskawurek, |
Contributor
Author
|
@tzolov perfect, thanks taking care of the PR and enhancing it! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new constructor to
CallToolResultwhich allows passing just aString.The string argument is mapped to a
Listwith just oneTextContentelement and makes the usage of creating aCallToolResulteasier.Motivation and Context
The Javadoc for the usage of
CallToolResultis diverging from the implementation at serveral places.As an example
McpServer.javahas the following example:But currently the
CallToolResultexpects different arguments and should be:As this can be confusing for new users of the SDK, I thought first that the documentation should be changed.
But on the other hand it's nice to have an easy way to create a
CallToolResultwith just oneStringentry.This would enhance the readability of a codebase and make the usage easier.
This change enables the usage by adding an additional constructor to
CallToolResult.How Has This Been Tested?
Tested it only manually. I can add (Unit) tests if wanted.
Breaking Changes
Types of changes
Checklist
Additional context