Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Result ¶
type Result struct {
// Data holds the structured result data (only set for successful results)
Data any
// JSONText holds the JSON string representation of Data
JSONText string
// Error holds any error that occurred (nil for successful results)
Error error
}
Result represents a common tool execution result that can be converted to either MCP or Toolset result types.
func NewErrorResult ¶
NewErrorResult creates an error result with the given error.
func NewSuccessResult ¶
NewSuccessResult creates a successful result with structured data. The data will be automatically marshaled to JSON. If marshaling fails, an error result is returned instead.
func (*Result) ToMCPResult ¶
func (r *Result) ToMCPResult() (*mcp.CallToolResult, error)
ToMCPResult converts the Result to an MCP CallToolResult. Returns (result, nil) following the MCP pattern where errors are encoded in the result, not the error return value.
func (*Result) ToToolsetResult ¶
func (r *Result) ToToolsetResult() (*api.ToolCallResult, error)
ToToolsetResult converts the Result to a Toolset ToolCallResult. Returns (result, nil) following the pattern where errors are encoded in the ToolCallResult, not the error return value.