ResultJSON marshals v as JSON and returns it as a successful tool result. If marshaling fails, it returns an error result.
(v any)
| 162 | // ResultJSON marshals v as JSON and returns it as a successful tool result. |
| 163 | // If marshaling fails, it returns an error result. |
| 164 | func ResultJSON(v any) *ToolCallResult { |
| 165 | data, err := json.Marshal(v) |
| 166 | if err != nil { |
| 167 | return ResultError(err.Error()) |
| 168 | } |
| 169 | return &ToolCallResult{Output: string(data)} |
| 170 | } |
| 171 | |
| 172 | type ToolType string |
| 173 |
no test coverage detected