UNPKG

ragatanga-mcp-sdk

Version:

SDK for integrating with the Ragatanga Management Control Plane (MCP) with Next.js 15, React 19, WebSocket and Arrow IPC support

161 lines (157 loc) 4.49 kB
/** * Base class for ontology-related errors */ declare class OntologyError extends MCPError { constructor(message: string, options?: ErrorOptions); } /** * Error thrown when an entity is not found in the ontology */ declare class OntologyEntityNotFoundError extends OntologyError { entityUri: string; constructor(entityUri: string, message?: string, options?: ErrorOptions); } /** * Error thrown when an invalid query is attempted */ declare class OntologySparqlError extends OntologyError { query: string; constructor(query: string, message?: string, options?: ErrorOptions); } /** * Error thrown when a modification operation fails */ declare class OntologyModificationError extends OntologyError { operation: string; entityUri?: string; constructor(operation: string, entityUri?: string, message?: string, options?: ErrorOptions); } /** * Error thrown when pagination parameters are invalid */ declare class OntologyPaginationError extends OntologyError { cursor?: string; constructor(cursor?: string, message?: string, options?: ErrorOptions); } /** * Parse error responses from the ontology server and convert them to appropriate error types */ declare function parseOntologyError(error: Error | HTTPError): Error; /** * Base error class for all MCP SDK errors */ declare class MCPError extends Error { status?: number; code?: string; cause?: unknown; constructor(message: string, options?: { status?: number; code?: string; cause?: unknown; }); /** * Creates a formatted error message with all available details */ toFormattedString(): string; } /** * Error thrown when there's a network-related issue */ declare class NetworkError extends MCPError { constructor(message: string, options?: { code?: string; cause?: unknown; }); } /** * Error thrown when a request times out */ declare class TimeoutError extends MCPError { constructor(message?: string, options?: { code?: string; cause?: unknown; }); } /** * Error thrown when a request receives a 4xx or 5xx response */ declare class HTTPError extends MCPError { response: Response; constructor(message: string, response: Response, options?: { code?: string; cause?: unknown; }); } /** * Error thrown when there's an authentication or authorization issue */ declare class AuthError extends MCPError { response?: Response; constructor(message: string, options?: { status?: number; code?: string; cause?: unknown; response?: Response; }); } /** * Error thrown when user is unauthorized to access a resource */ declare class UnauthorizedError extends AuthError { constructor(message: string, options?: { code?: string; cause?: unknown; response?: Response; }); } /** * Error thrown when a tenant is not found */ declare class TenantNotFoundError extends HTTPError { constructor(message: string, options?: { code?: string; cause?: unknown; }); } /** * Error thrown when there's an issue with WebSocket connection */ declare class WebSocketError extends MCPError { event?: Event; constructor(message: string, options?: { event?: Event; code?: string; cause?: unknown; }); } /** * Error thrown when there's an issue with parsing a response */ declare class ParseError extends MCPError { data?: unknown; constructor(message: string, options?: { data?: unknown; code?: string; cause?: unknown; }); } /** * Error thrown when validation fails (e.g., with zod or other validators) */ declare class ValidationError extends MCPError { errors?: unknown; constructor(message: string, options?: { errors?: unknown; code?: string; cause?: unknown; }); } /** * Create appropriate error instance from an unknown error */ declare function createError(error: unknown): MCPError; /** * Create appropriate HTTP error based on response status */ declare function createHttpError(response: Response): MCPError; export { AuthError, HTTPError, MCPError, NetworkError, OntologyEntityNotFoundError, OntologyError, OntologyModificationError, OntologyPaginationError, OntologySparqlError, ParseError, TenantNotFoundError, TimeoutError, UnauthorizedError, ValidationError, WebSocketError, createError, createHttpError, parseOntologyError };