File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
mcp/src/main/java/io/modelcontextprotocol/spec Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -756,6 +756,22 @@ public record CallToolRequest(// @formatter:off
756756 public record CallToolResult ( // @formatter:off
757757 @ JsonProperty ("content" ) List <Content > content ,
758758 @ JsonProperty ("isError" ) Boolean isError ) {
759+
760+ /**
761+ * Creates a new instance of {@link CallToolResult} with a string containing the
762+ * tool result.
763+ *
764+ * @param content The content of the tool result. This will be mapped to a one-sized list
765+ * with a {@link TextContent} element.
766+ * @param isError If true, indicates that the tool execution failed and the content contains error information.
767+ * If false or absent, indicates successful execution.
768+ */
769+ public CallToolResult (String content , Boolean isError ) {
770+ this (
771+ List .of (new TextContent (content )),
772+ isError
773+ );
774+ }
759775 } // @formatter:on
760776
761777 // ---------------------------
You can’t perform that action at this time.
0 commit comments