Errors and limits
The codes a tool answers with, the HTTP answers of the endpoint and of the authorisation endpoints, and the limits the server enforces.
On this page
Where a refusal shows up#
- As an HTTP status, before any tool runs: no token, a token that no longer stands, a body that is too large.
- As a protocol error (JSON-RPC
error): a method or a tool that is not there for this connection. - Inside a tool's result, with
isError: true: the tool ran and could not do what was asked. The HTTP status is200.
Tool error codes#
A tool that cannot do what was asked answers { "error": { "code", "message" } }. The codes are stable; the message is one plain sentence, never a stack trace.
| Code | Meaning | What a client should do |
|---|---|---|
| not_found | The record does not exist, or is not this member's to see. The two are never told apart. | Do not retry. Ask the member which record they mean. |
| forbidden | The member may see it but not do this to it. | Do not retry. Say what the member's role does not allow. |
| invalid_input | The arguments fit the schema but break a rule the tool checks itself: a period that is too long, a time in the past, nothing to change. | Correct the arguments. |
| conflict | The same key with other arguments, or a state that does not allow it: a link that is already live, a slug that is taken, an appointment whose online meeting would have to move. | Use a new key for a different request, or tell the member; some answers carry openInEcoMark. |
| not_connected | An app this needs is not connected for this agency or member. The answer says which (service, managedBy, manageAt). | Tell the member. Nothing can be connected from a client. |
| in_progress | The same request is being handled right now. | Ask again in a moment, with the same key. |
| unavailable | Too many requests from this connection, a save that did not land, or anything unexpected. | Wait, then retry with the same arguments. Nothing was written. |
{
"error": {
"code": "not_found",
"message": "No lead with that id is available to this member."
}
}{
"error": {
"code": "invalid_input",
"message": "`to` must be after `from`, and the period at most 62 days."
}
}{
"error": {
"code": "not_connected",
"message": "Gmail is not connected for this agency, so the draft cannot be sent. An admin connects it in EcoMark under Settings → Integrations.",
"service": "gmail",
"managedBy": "agency",
"manageAt": "https://www.ecomarkai.com/settings/integrations"
}
}{
"error": {
"code": "unavailable",
"message": "Too many requests from this connection. Wait a minute and try again."
}
}Arguments the schema refuses#
Arguments that do not fit a tool's schema (a wrong type, a number out of range, a missing required field) are refused before the tool runs. That answer is text only: it has isError: true but no structuredContent and no code.
{
"content": [
{
"type": "text",
"text": "Input validation error: Invalid arguments for tool list_leads: limit: Too big: expected number to be <=50"
}
],
"isError": true
}A tool that is not there#
A connection is only given the tools its permissions cover, within what the agency allows today. Calling another one by name is a protocol error, the same as for a name that does not exist. whoami lists the permissions the connection holds.
{
"jsonrpc": "2.0",
"id": 10,
"error": {
"code": -32602,
"message": "Tool update_lead not found"
}
}HTTP answers of the MCP endpoint#
| Status | When | Body |
|---|---|---|
200 | A request was answered. A tool's own refusal is also 200. | After an initialize handshake: text/event-stream with one message event. For the newest revision: application/json. |
202 | A notification was accepted. | Empty. |
400 | The body is not JSON, or the headers and the body of a newest-revision request disagree. | A JSON-RPC error with id: null or the request's id. |
401 | No token, a token that is not valid any more, or a member who cannot act right now. WWW-Authenticate names the metadata address. | invalid_token with one sentence: see below. |
403 | A browser page on a site that is not allowed sent the request (its Origin). | A JSON-RPC error. |
405 | GET or DELETE with a valid token. The server keeps no sessions and offers no separate stream. | A JSON-RPC error. |
406 | The Accept header does not list both application/json and text/event-stream. | A JSON-RPC error. |
413 | The body is larger than the limit below. | A JSON-RPC error. |
503 | The server is switched off for this EcoMark. | temporarily_unavailable. |
The 401 always has the same shape; its sentence says which case it is.
| error_description | Case |
|---|---|
| Missing Authorization header | No token was sent. |
| The access token is not valid. | Unknown or expired, or its connection was revoked. |
| The EcoMark member this token belongs to is not active in that agency any more. | The member was suspended or removed. |
| The EcoMark workspace this token belongs to is not active. | Setup is not finished, or the subscription is not active. |
| The agency does not allow external assistants for this member. | The agency's rule is Nothing. |
{"jsonrpc":"2.0","error":{"code":-32000,"message":"Method not allowed."},"id":null}{"jsonrpc":"2.0","error":{"code":-32000,"message":"Not Acceptable: Client must accept both application/json and text/event-stream"},"id":null}{"jsonrpc":"2.0","error":{"code":-32000,"message":"Payload Too Large: Request body must not exceed 262144 bytes"},"id":null}{"error":"temporarily_unavailable","error_description":"EcoMark is not serving external assistants right now."}A request of the newest revision#
The newest revision needs no handshake: each request names its revision in the MCP-Protocol-Version header and in _meta, and repeats its method (and the tool's name) in headers. If a header is missing or disagrees with the body, the answer is 400.
POST /api/mcp HTTP/1.1
Authorization: Bearer ecm_at_…
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: whoami
{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"whoami","arguments":{},"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"example","version":"1.0.0"},"io.modelcontextprotocol/clientCapabilities":{}}}}The answer is application/json. Its result carries the same content and structuredContent, plus resultType and the server's name in _meta.
Answers of the authorisation endpoints#
| Endpoint | Status | Body |
|---|---|---|
| Token | 400 | invalid_request (not a form, a parameter given twice, too large), invalid_grant (a code or refresh token that is not valid), invalid_target (a resource other than the MCP endpoint). |
| Register | 400 | invalid_client_metadata or invalid_redirect_uri. |
| Revoke | 200 | Empty, also for a token EcoMark does not know. 400 invalid_request when no token is given. |
| Authorize | 302, or a plain page | Sent back to the client with error and iss when the client's address can be trusted; otherwise a page with one sentence, and nothing is sent anywhere. |
| Token, Register, Revoke | 429 | slow_down, with Retry-After: 60. |
| All of them | 503 | temporarily_unavailable, when the server is switched off. |
{"error":"invalid_grant","error_description":"Invalid grant: refresh token is invalid"}Limits#
These are the server's own values.
Tool calls
- Tool calls, per connection
- 120 in 1 minuteOver the limit the tool answers with the code unavailable; the HTTP status stays 200.
- Writes and approval requests, per connection
- 200 in 1 hour
- Request body
- 256 KiB at mostA larger body is answered 413.
Lists and periods
- List page size
- 20 by default, 50 at mostnextCursor in an answer gives the next page; null means there is none.
- Period for listing appointments
- 62 days at most
- Period for checking availability
- 14 days at most
- Free slots returned
- 24 at most
Repeated writes
- Same arguments, no key
- Carried out once within 10 minutes
- A caller's own idempotencyKey
^[\x21-\x7e]{8,80}$Carried out once for that connection and tool, with no time limit. The same key with other arguments is answered conflict.
Lifetimes
- Access token
- 1 hour
- Refresh token
- 30 daysReplaced on every use. One presented twice ends the whole connection.
- Authorisation code
- 2 minutesSingle use.
- Pending consent request
- 10 minutes
- Approval request
- 1 dayAfter that it reads expired and has to be asked again.
Authorisation endpoints
Per calling address. Over the limit: 429.
- Authorize
- 60 in 10 minutes
- Token
- 240 in 10 minutes
- Register
- 30 in 1 hour
- Revoke
- 60 in 10 minutes
- Token or registration request
- 16,384 characters at most
Retrying safely#
- A read can always be repeated.
- A write can be repeated with the same arguments: it is carried out once, and the repeat is marked
replayed. Send anidempotencyKeywhen a retry might come late. - On
in_progress, wait and ask again with the same key. Do not send a new key: that would be a second request. - On
unavailable, nothing was written. Wait before retrying; a connection over its limit is refused until its window has passed. - On
401, do not retry with the same token. Renew it, and if that fails, the member has to connect again.