Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions mcp/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,20 @@ func NewToolResultResource(
}
}

// NewToolResultError creates a new CallToolResult with an error message.
// Any errors that originate from the tool SHOULD be reported inside the result object.
func NewToolResultError(text string) *CallToolResult {
return &CallToolResult{
Content: []Content{
TextContent{
Type: "text",
Text: text,
},
},
IsError: true,
}
}

// NewListResourcesResult creates a new ListResourcesResult
func NewListResourcesResult(
resources []Resource,
Expand Down