/** * The error taxonomy for the whole server, and the translation from Google's * HTTP failures into it. * * This lives in `core/` rather than under `gmail/` because Drive and Calendar * fail in exactly the same ways and must be actionable in exactly the same * terms. `gmail/types.ts` re-exports it so nothing that already imported it * from there had to change. * * The class name still says "Gmail" — see the renaming note in the README. */ /** An account is identified by its email address. It is the primary key everywhere. */ export type AccountId = string; export type GmailMcpErrorCode = 'NO_CREDENTIALS' | 'NO_ACCOUNTS' | 'UNKNOWN_ACCOUNT' | 'NOT_AUTHORIZED' /** The account is authorised, but not for the API being called. Needs re-consent. */ | 'MISSING_SCOPE' | 'TOKEN_REFRESH_FAILED' | 'RATE_LIMITED' | 'NOT_FOUND' | 'INVALID_ARGUMENT' | 'API_ERROR'; /** * A failure that is safe and useful to show the model. * * Anything thrown as `GmailMcpError` is rendered as a tool error with its * message intact; anything else is reported generically, so unexpected * internals never leak into a response. */ export declare class GmailMcpError extends Error { readonly code: GmailMcpErrorCode; readonly account?: AccountId; constructor(code: GmailMcpErrorCode, message: string, account?: AccountId); } /** * Turns a Gaxios/Google failure into something an agent can act on. * * The distinction that matters is 401/403 (re-authorise) versus 429/5xx (retry * later) versus 404 (the id is wrong): an agent that cannot tell them apart * will retry the one case that will never succeed. * * `service` is the human name of the API — "Gmail", "Drive", "Calendar" — so * the message says which one refused, which matters now that one account can * be authorised for some of them and not others. */ export declare function mapGoogleError(error: unknown, service: string, account?: AccountId): GmailMcpError; //# sourceMappingURL=errors.d.ts.map