newMCPError creates a jsonrpc.Error with the given code, message, and optional data. The data value is marshaled via mcpErrorData.
(code int64, msg string, data any)
| 9 | // newMCPError creates a jsonrpc.Error with the given code, message, and optional data. |
| 10 | // The data value is marshaled via mcpErrorData. |
| 11 | func newMCPError(code int64, msg string, data any) error { |
| 12 | return &jsonrpc.Error{Code: code, Message: msg, Data: mcpErrorData(data)} |
| 13 | } |
| 14 | |
| 15 | // mcpErrorData marshals data to JSON for use in jsonrpc.Error.Data field. |
| 16 | // Returns nil if marshaling fails to avoid errors in error handling. |
no test coverage detected