Documentation
¶
Index ¶
- type MCPError
- func ConflictError(operation, action, resourceType, resourceID, currentState string) *MCPError
- func NetworkError(operation string, cause error) *MCPError
- func NewMCPError(operation, message string, cause error) *MCPError
- func NotFoundError(operation, resourceType, resourceID string) *MCPError
- func ParseHTTPError(operation string, err error, resourceID string) *MCPError
- func PermissionError(operation, resourceType, resourceID string) *MCPError
- func ServerError(operation string, cause error) *MCPError
- func ValidationError(operation, parameter, issue string) *MCPError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MCPError ¶
type MCPError struct {
Operation string // The operation that failed (e.g., "get_environment")
Message string // Human-readable error message
Suggestion string // Optional suggestion for the user
Cause error // The underlying error
StatusCode int // HTTP status code if applicable
}
MCPError represents an MCP-specific error with context and suggestions
func ConflictError ¶
ConflictError creates an error for state conflicts
func NetworkError ¶
NetworkError creates an error for network/connectivity issues
func NewMCPError ¶
NewMCPError creates a new MCP error with context
func NotFoundError ¶
NotFoundError creates an error for when a resource is not found
func ParseHTTPError ¶
ParseHTTPError converts HTTP errors into user-friendly MCP errors
func PermissionError ¶
PermissionError creates an error for permission/access issues
func ServerError ¶
ServerError creates an error for server-side issues
func ValidationError ¶
ValidationError creates an error for parameter validation failures
func (*MCPError) ToJSONRPCCode ¶
ToJSONRPCError converts an MCPError to appropriate JSON-RPC error code
func (*MCPError) WithStatusCode ¶
WithStatusCode adds an HTTP status code to the error
func (*MCPError) WithSuggestion ¶
WithSuggestion adds a suggestion to the error