Error Handling
All errors follow a consistent format with an error message and code.Error format
Error codes
MCP tool errors vs HTTP errors
There are two levels of errors:HTTP-level errors
Returned as standard HTTP responses (status code + JSON body). These happen before a tool executes — auth failures, rate limits, missing routes.Tool-level errors
Returned inside a successful HTTP 200 response withisError: true in the MCP result. These happen during tool execution — invalid parameters, upstream API failures, etc.
Source-specific errors
Each ad platform can return specific errors that are caught and wrapped:Meta
MetaApiProcessingError— Graph API returned an error (invalid params, permissions, etc.)- Rate limiting — Meta’s Business Use Case rate limiting triggers automatic retries (3x with backoff)
- RestLi errors — LinkedIn’s API uses a specific error format that is normalized
serviceErrorCode— LinkedIn-specific error codes are included in the error message
ChannelNotConnectedError— Google credentials not found in API key- Cross-source errors —
/drive/upload-to-metarequires both Google and Meta channels connected