Skip to main content

The assistant's surface

The assistant is not a separate program with its own access to your data. It is a client of the same API you are, acting as the person who asked it, and every tool it can use is a named, typed operation somebody declared.

That surface is published over the Model Context Protocol, so you can point your own tools at it: Claude Desktop, an editor, an agent you have written.

Connecting​

One endpoint, JSON-RPC over HTTP:

POST /api/v1/mcp
Authorization: Bearer <your access token>

The token is an ordinary one from POST /api/v1/auth/login. There is no MCP-specific identity and no token that means "the assistant" — which is the point. A client connected with your token can do exactly what you can do, sees exactly what you can see, and is refused exactly what you would be refused.

initialize returns the server's capabilities; tools/list returns the tools you may use, which is a shorter list than somebody else's if your role is narrower.

What the tools are​

Two kinds, and the difference is the safety property the whole design rests on.

Read tools answer a question: stock on hand, open orders for a customer, what an item cost and why. They are parameterised queries, never SQL — a model handed a query language will eventually be talked into writing a query nobody intended.

Action tools change something, and they propose by default. Calling one without confirming returns what it would do and the arguments it would do it with; performing it is a second, deliberate call. Something irreversible happening because a sentence was ambiguous is the failure this is arranged around.

Anything the product drafts and does not perform lands in the approvals queue, where a person reads it and says yes or no. Work that posts to the ledger — a stock write-off, a payment — needs a second permission to approve, granted deliberately rather than by default.

Building reports from your AI assistant​

Connected to Claude, ChatGPT or another MCP client, your assistant can build a Custom report for you from start to finish. Ask in plain words, for example:

  • "Build me a report of sales by customer for last quarter, top ten, as a bar chart."
  • "Show me open sales orders grouped by salesperson, then keep it as a report."
  • "Change my Top customers draft to group by month instead."
  • "Run my saved report Weekly sales and tell me which customer grew most."

What happens:

  1. The assistant looks up what you may report on and the fields of that data (analytics.sources, analytics.fields) — only the data your role can read.
  2. It tries the report (analytics.run) and reads you the figures. Nothing is kept yet. If you only see your own customers in the app, the assistant only sees your own customers too.
  3. When you want to keep it, it saves it as your private draft (analytics.draft_report) and gives you a link that opens it in Reports → Custom reports. This happens at once — there is nothing to approve, because a draft is yours alone: it is not shared, not scheduled, and nobody receives it.
  4. Ask for changes and it changes the same draft (analytics.update_draft). If you edited the draft yourself in the meantime, it is told so and reads it again first rather than overwriting your edit.
  5. You open the link, check it, and press Save. Sharing it with colleagues and scheduling it by email stay with you; the assistant cannot do either, and it cannot change a report that is already saved — it offers a new draft instead.

A token that may only read lets the assistant run and read reports but not keep or change drafts.

If a call fails​

Every answer says what happened in a code, never only in a sentence. A tool's answer carries structuredContent.status and, when something went wrong, structuredContent.errors[0].code; the answer's _meta and the response's X-Request-ID header carry the request id, and the envelope the operation id. Quote either to support and they find the call in seconds.

What each code means, and what to do:

CodeWhat happenedWhat to do
authentication_failed (HTTP 401)The token is unknown or was revoked.Connect again (sign in, or create a new token).
session_expired (HTTP 401)The token expired.An app connected by OAuth uses its refresh token; a token made by hand is replaced in Settings → AI models → MCP.
permission_deniedYour role may not do this; the answer names the permission.Ask an administrator, or do something your role allows.
validation_errorThe arguments were not ones the tool takes; the sentence names the field.Fix the arguments and call again.
server_overloadedEvery database connection was busy. Nothing was done.Wait retry_after seconds, then call again.
connection_failed / unavailableThe connection to the company's database dropped, or it could not be reached. Nothing was kept.Call again after a moment. A read has already been tried a second time by the server.
request_timeoutThe call ran past its time limit and was stopped. Nothing was kept.Call again, or ask for less: a shorter period, a smaller limit.
database_timeoutThe database stopped a query that took too long. Nothing was kept.As for request_timeout.
request_cancelledThe client disconnected, so the call was stopped.Nothing to do: nothing was kept.
outcome_unknown (status outcome_unknown)A change was being saved when the connection went. It may or may not have been saved.Do not send a new request. Send the same one again with the same idempotency_key: you get what was saved, or it runs once.
internal_errorSomething broke on our side. Nothing was saved.Try once more; if it happens again, give support the request id.

When a server cannot answer at all — it is starting, shutting down, or the database behind sign-in is too busy — the answer is HTTP 503 with a Retry-After header, and the JSON-RPC error's data carries the same code, retry_after and request id.

Retrying. Each error says whether it is worth sending again (retryable). Wait between tries, longer each time, with some randomness, and stop after a few: for example 0.25 s, then up to 0.5 s, 1 s, 2 s, 4 s, 8 s, each a random wait up to that, and never less than retry_after. Several clients retrying in step make a busy server busier; the randomness spreads them out.

Changes. Send an idempotency_key (a new UUID per change) with every tool that changes something, and the same key when you send the same change again. However many times it arrives — a retry after a timeout, a double click, two copies at once — it is done once, and every copy gets the first answer. A read can be retried freely; a change without a key should not be retried blindly.

Time limits. A tool call has about 25 seconds; a few heavy ones (books health, running a report, a general-ledger detail) about 55. A call is never left hanging: it answers inside its limit, or is stopped and says so.

Watching the MCP server's health​

Settings → AI models → MCP health shows how the MCP server is serving AI apps for your company. It needs the permission that manages AI settings (agent_settings.manage, the Admin's out of the box). Pick a window — 15 minutes, 1 hour, 6 hours or 24 hours — and the page refreshes every 30 seconds; Pause refreshing holds the figures still while you read them.

  • Availability counts only the server's own failures (a dropped database connection, a timeout, an error of ours) against every call. A call refused because of the request — a missing permission, a wrong argument — is for the app to fix and does not lower availability.
  • Calls, response time (p95, with the average, p50 and p99) and the requests in flight on the server that answered and on every server.
  • Timeouts, cancellations, the server's own retries of a read and how many then succeeded, and outcome unknown: changes cut off while being saved. A figure that needs a look is outlined, and the note under the figures says what to do. An outcome-unknown change is resolved by the app sending the same change again with the same idempotency_key; check the records it touched if you are unsure.
  • Errors by code — a chart, with what each code means in words (the table above, under If a call fails, says what to do about each).
  • Slowest tools and errors by tool, each error marked Retry may work or Retrying will not help.
  • Recent failures — the latest 50, each with its request id and operation id and a button to copy them. Give either to support: engineers find the call in the server's logs by it.
  • Servers — every API server seen in the last minute: ready or draining, how far its event loop is behind, CPU, memory, requests in flight, and how full its connection pools are (the control pool and the company pools, with any connections borrowed over a pool's size). A bar that stays full means more load than the servers were sized for.

Calls, errors and failures are your company's only. The servers are shared by every company, so that section shows load and resources and never another company's data. Nothing on the page shows a tool's arguments, a payload, a credential or an amount.

If no AI app has called a tool in the window, the page says so: connect one in Settings → AI models → MCP, or choose a longer window.

What you should expect it not to do​

  • It cannot see a record you cannot see, in a tool result or in a cited knowledge-base article.
  • It cannot approve its own drafts.
  • It cannot act unrestricted. A system actor bypasses permission checks and an agent is refused the right to be one.

Every action it takes is audited as an agent's, with the sentence that produced it recorded beside it.

Buying and picking: tools that explain themselves​

  • purchasing.what_to_buy (read) — each suggestion carries its basis: on hand, reserved, on order (sent purchase orders only), covered, the margin, the reorder point or fixed lot, and the rounding to the supplier's cases. A draft or approved order that is not sent yet is shown as on_order_unsent and never counted. Where no supplier can be proposed, vendor_reason says why: no_vendor_item, mapping_not_effective, vendor_not_approved or only_legacy_supplier_link. site and limit narrow it; total counts everything.
  • purchasing.preferred_vendor (read) — the supplier's id and name on every row, whether it may be ordered from (orderable), and a reason when there is no preferred supplier.
  • purchasing.vendor_coverage (read, new) — items with a reorder point that cannot be bought properly, with counts per reason (the four above, plus no_price, no_lead_time, pack_size_missing, purchase_unit_missing).
  • inventory.preview_pick_sequence (read, new) — a pick list's current and suggested walking order, both distances and the saving (millimetres, metres, percent, walking seconds at the stated 1.0 m/s), which legs follow the travel graph or a straight line, shelves nothing can measure, and a version. Optional start_location (code) or start_location_id.
  • inventory.sequence_pick_list (action) — now takes start_location or start_location_id, and expected_version from the preview: when the list has changed since, it is refused with conflict and nothing is saved. Preview again and apply the new version.

Sales orders: previews, drafts and backorders​

  • sales.preview_order (read) — builds the order exactly as the order screen would (customer, prices, units, tax, the credit and compliance checks) and saves nothing. A preview draws no order number and holds nothing: other people raising orders and quotes while it runs are not kept waiting, and the next real order takes the next number. Tax is worked out once for the whole order, so a long order previews in about the time a short one takes per line (100 lines: about 10 seconds), and a company using an outside tax service is asked once per preview rather than once per line.
    • Each line says where its price came from (price_source: price_list, base, manual for a price you typed, none for no price found) and carries its own warnings, each with a code: unpriced (no price list row and no base price: the line is at 0.00 and untaxed — send unit_price, 0 if it is meant to be free) and would_backorder (more asked than is available to promise). The same list, with the line number and SKU, is line_warnings; the sentences in warnings are unchanged.
    • A line may carry price_override_reason to sell under the item's minimum selling price. The price is kept only for a person who may approve the order (sales_order.approve, or override.price_under_floor) and only while the company allows the override. An AI app is never such a person, so its line under the floor is refused with refusal: price_under_floor, the floor (floor_price) and may_override: false: save the draft at or above the floor and keep the lower price on the order screen.
  • sales.create_draft_order (action, saved at once) — the same order, saved as a draft with a real number. Totalled once, like the preview.
  • sales.backorders (read, new) — what customers are owed: goods on confirmed orders that have not shipped and have no stock held for them (ordered, less shipped, less closed short, less allocated — the Backorders screen's own figure). Needs sales_order.read; a rep limited to their own accounts is told about their own customers only.
    • view: lines (default) — each order line with ordered, shipped, short_closed, allocated and outstanding in the item's unit, its value and currency, the incoming purchase order (incoming.quantity, incoming.expected_on, incoming.po_number; expected_on is null where nothing on order carries a date) and a reason: stock_shortage, awaiting_allocation (stock is free now and picking would hold it), on_hold, or null where it cannot be said (you may not see stock, the order type never holds stock, or the line awaits an override). by_item and by_customer total them.
    • Filters: customer, sku, site (warehouse code), order (number), min_age_days, and for lines expected_before (supply due before a date). limit and offset page through; total counts everything and next_offset is where the next page starts.

Hundreds of tools: finding the right one (tools.search)​

An account with every app on offers several hundred tools. Some AI apps cope badly with a list that long. Two ways to give them a short one:

  • ?groups= — only the tools of a part of the business: https://<your domain>/api/v1/mcp?groups=sales,inventory.
  • Discovery mode — https://<your domain>/api/v1/mcp?mode=discovery. The app is shown a handful of tools: company.whoami, the ones to follow and decide proposals, and two that reach every other tool:
    • tools.search — "what can I use for this?". Give it the task in a few words ("overdue invoices", "trial balance", "who am i") or a tool's name; optionally group (sales, accounting, …), app (the first part of a tool's name, such as ledger), read_only: true for tools that only read, and limit (up to 25, 8 by default). It answers the best matches, each with its name, what it does, whether it reads, saves a draft or proposes a change (access), and its inputSchema.
    • tools.call — run one of them: {"name": "<tool>", "arguments": {...}, "idempotency_key": "<uuid>", "company_id": "<id>"}. It is exactly the same as calling the tool by its name: the same answer, the same refusals, and a change is proposed or saved as a draft as that tool says.

Searching never shows a tool you could not use: it looks only through the tools your role may use, in the apps your company has on, and only through reads on a read-only token. Without either option the full list is what it always was.

When AI is paused (ai_paused)​

An administrator can pause AI actions for the whole company (Settings → AI models → Pause AI actions). While AI changes are paused, a tool that changes something answers status validation_failed with the code ai_paused; while everything is paused, reads answer it too. It is a deliberate stop, not a fault: sending it again fails until AI is resumed. Tell the person, who can ask their administrator.

Approving what your AI app proposed​

A proposal your AI app raised with your token is yours: with the company's default, a proposal that moves money (a payment, a purchase order) must be approved by somebody else, and approvals.decide refuses yours with permission_denied. You may still reject it.