Error handling

The Deel MCP server returns errors at two levels: HTTP transport errors and JSON-RPC protocol errors. Understanding both levels helps you diagnose issues and implement appropriate retry strategies.

HTTP errors

HTTP-level errors occur before the JSON-RPC layer processes the request. These indicate transport, authentication, or rate limiting issues.

Status codeMeaningCauseResolution
401UnauthorizedMissing, invalid, or expired access tokenRe-authenticate using the OAuth2 flow or provide a valid personal access token
403ForbiddenToken lacks the required scopes for the requested operation at the transport levelRequest additional scopes during the OAuth2 authorization flow. Note that scope/permission errors from individual tools are often surfaced as tool execution errors (isError: true) rather than HTTP 403 — see Tool execution errors
429Too Many RequestsRate limit exceededWait for the duration specified in the Retry-After header before retrying
500Internal Server ErrorUnexpected server-side failureRetry the request after a brief delay. If the error persists, contact Deel support
502Bad GatewayUpstream service unavailableRetry the request after a brief delay
503Service UnavailableServer temporarily unable to handle the requestRetry the request with exponential backoff

JSON-RPC errors

JSON-RPC errors are typically returned within an HTTP 200 response, though some errors may be returned with non-200 HTTP statuses (such as 400, 401, or 500) depending on where in the gateway the failure occurs. The error object contains a numeric code and a descriptive message.

Error codeMeaningCauseResolution
-32700Parse errorThe request body is not valid JSONVerify the JSON-RPC request is well-formed
-32600Invalid requestThe JSON-RPC request structure is invalid (missing jsonrpc, method, or id fields)Ensure the request conforms to the JSON-RPC 2.0 specification
-32601Method not foundThe requested method does not exist on the serverVerify the method name. Use tools/list to retrieve available tools
-32602Invalid paramsThe parameters provided to the tool are invalid or missing required fieldsCheck the tool input schema and provide all required parameters with correct types
-32603Internal errorServer-side error during method executionRetry the request. If the error persists, contact Deel support

Error response format

1{
2 "jsonrpc": "2.0",
3 "id": 1,
4 "error": {
5 "code": -32602,
6 "message": "Invalid params: 'contract_id' is required"
7 }
8}

Tool execution errors

Tool execution errors are distinct from JSON-RPC protocol errors. When a tool is invoked successfully at the protocol level but the underlying API operation fails, the server returns a result with isError: true and an error message in the content.

1{
2 "jsonrpc": "2.0",
3 "id": 1,
4 "result": {
5 "content": [
6 {
7 "type": "text",
8 "text": "Error: Contract not found with the specified ID."
9 }
10 ],
11 "isError": true
12 }
13}

Common tool execution errors include:

ErrorCauseResolution
Insufficient permissionsThe access token does not include the required scopeRe-authorize with the necessary scopes
Resource not foundThe specified resource ID does not existVerify the resource ID is correct
Validation errorThe input parameters do not meet the API requirementsCheck parameter values against the tool description
ConflictThe operation conflicts with the current resource stateVerify the resource state before retrying

Retry strategies

Not all errors are retryable. Use the following guidance to determine whether to retry a failed request.

Retryable errors

  • 429 Too Many Requests: Wait for the duration in the Retry-After header, then retry
  • 500 Internal Server Error: Retry with exponential backoff (starting at 1 second, doubling each attempt, maximum 5 retries)
  • 502 Bad Gateway and 503 Service Unavailable: Retry with exponential backoff
  • -32603 Internal error: Retry with exponential backoff

Non-retryable errors

  • 401 Unauthorized: Re-authenticate before retrying
  • 403 Forbidden: Request additional scopes; retrying with the same token will not succeed
  • -32600 Invalid request and -32602 Invalid params: Fix the request before retrying
  • -32601 Method not found: The tool does not exist; verify the tool name
  • Tool execution errors (validation, not found): Fix the input parameters before retrying

Implement exponential backoff with jitter when retrying requests. Start with a 1-second delay, double the delay on each retry, and add a random offset to avoid thundering herd issues. Limit retries to a maximum of 5 attempts.

Rate limits

The Deel MCP server enforces the same rate limits as the Deel REST API. When you exceed the rate limit, the server returns a 429 status code with a Retry-After header indicating the number of seconds to wait.

For detailed rate limit information, see the rate limits documentation.

Next steps