MCP Apps Kit - v0.5.0
    Preparing search index...

    Class AppError

    Custom error class for the SDK

    Provides structured error information that can be formatted for different protocols (MCP Apps, ChatGPT).

    throw new AppError(
    ErrorCode.VALIDATION_ERROR,
    "Invalid input: name is required",
    { field: "name", type: "required" }
    );

    Hierarchy

    • Error
      • AppError
    Index

    Constructors

    • Create a new AppError

      Parameters

      • code: ErrorCodeType

        Error code from ErrorCode enum

      • message: string

        Human-readable error message

      • Optionaldetails: Record<string, unknown>

        Optional additional error details

      • Optionalcause: Error

        Optional underlying error

      Returns AppError

    Properties

    cause?: Error

    Optional underlying error

    Error code from ErrorCode enum

    details?: Record<string, unknown>

    Optional additional error details

    Methods

    • Convert to JSON for logging/serialization

      Returns Record<string, unknown>

      JSON representation of the error

    • Format error for MCP protocol response

      Returns { content: { text: string; type: "text" }[]; isError: true }

      MCP-compatible error response

    • Format error for OpenAI protocol response

      Returns { content: { text: string; type: "text" }[]; isError: true }

      OpenAI-compatible error response