60aef5d2e3
Move from `mark3labs/mcp-go` to `modelcontextprotocol/go-sdk`. This is mostly focused on updating tool schema and tool handler signatures, along with any associated internal changes related to those changes. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com> Co-authored-by: LuluBeatson <lulubeatson@github.com> Co-authored-by: Lulu <59149422+LuluBeatson@users.noreply.github.com> Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com> Co-authored-by: Sam Morrow <info@sam-morrow.com>
50 lines
1010 B
Go
50 lines
1010 B
Go
package utils //nolint:revive //TODO: figure out a better name for this package
|
|
|
|
import "github.com/modelcontextprotocol/go-sdk/mcp"
|
|
|
|
func NewToolResultText(message string) *mcp.CallToolResult {
|
|
return &mcp.CallToolResult{
|
|
Content: []mcp.Content{
|
|
&mcp.TextContent{
|
|
Text: message,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func NewToolResultError(message string) *mcp.CallToolResult {
|
|
return &mcp.CallToolResult{
|
|
Content: []mcp.Content{
|
|
&mcp.TextContent{
|
|
Text: message,
|
|
},
|
|
},
|
|
IsError: true,
|
|
}
|
|
}
|
|
|
|
func NewToolResultErrorFromErr(message string, err error) *mcp.CallToolResult {
|
|
return &mcp.CallToolResult{
|
|
Content: []mcp.Content{
|
|
&mcp.TextContent{
|
|
Text: message + ": " + err.Error(),
|
|
},
|
|
},
|
|
IsError: true,
|
|
}
|
|
}
|
|
|
|
func NewToolResultResource(message string, contents *mcp.ResourceContents) *mcp.CallToolResult {
|
|
return &mcp.CallToolResult{
|
|
Content: []mcp.Content{
|
|
&mcp.TextContent{
|
|
Text: message,
|
|
},
|
|
&mcp.EmbeddedResource{
|
|
Resource: contents,
|
|
},
|
|
},
|
|
IsError: false,
|
|
}
|
|
}
|