Export GetError and SetError methods (#753)

Exported GetError and SetError. 

Fixes #64

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Jonathan Amsterdam 2026-01-15 11:46:13 -05:00 • committed by GitHub
commit 13488f7da1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -116,17 +116,17 @@ type CallToolResult struct {
err error
}
// TODO(#64): consider exposing setError (and getError), by adding an error
// field on CallToolResult.
func (r *CallToolResult) setError(err error) {
// SetError sets the error for the tool result and populates the Content field
// with the error text. It also sets IsError to true.
func (r *CallToolResult) SetError(err error) {
r.Content = []Content{&TextContent{Text: err.Error()}}
r.IsError = true
r.err = err
}
// getError returns the error set with setError, or nil if none.
// GetError returns the error set with SetError, or nil if none.
// This function always returns nil on clients.
func (r *CallToolResult) getError() error {
func (r *CallToolResult) GetError() error {
return r.err
}