Skip to content

Token efficiency

An agent pays in tokens for everything an MCP server sends it, starting with the tool list it reads before doing anything. These are the measured costs of Trustline's server, response by response, and the design choices behind them.

Method

Measured 2026-12-04 at commit 8eaf1ea with OpenAI's tiktoken encodings o200k_base and cl100k_base (js-tiktoken). Other models' tokenizers give different counts. The script scripts/measure-tokens.ts (pnpm tokens) starts the real MCP route handler with an in-memory database, a fixed clock and seeded ids, makes each call below the way a client would, and counts the response. Tool results count the text block the model reads; protocol results (tool list, discovery, events, resources) count their JSON without _meta. Workflow rows add up measured responses. The run uses a test host name, so URLs in it are a few characters shorter than on trustline.app.

The numbers on this page are read from the file the script writes, and a test in the repository re-measures on every run and fails if the code no longer matches them. They change only when the responses change.

Workflows

Tokens for common sequences of calls, one envelope with one signer:

Measured tokens per workflow
WorkflowCallso200k_basecl100k_baseBytes
First-call overhead, legacy client: initialize + tools/list28528393,442
First-call overhead, 2026-07-28 client: server/discover + tools/list28938803,576
Send one envelope: the create call the agent writes plus its result2107105368
Wait by polling tl_read status 10 times (9 sent, then completed)104804701,383
Wait by events/poll 10 times (sent event, 8 empty, then viewed+signed+completed)107757692,250
Wait by events/poll on envelope.completed 10 times (9 empty, then completed)104944921,417
Discovery on demand: tl_help {} then tl_help {op}25385381,782
  • First-call overhead is what a client loads once per session: 852 tokens (o200k) for an initialize client, 893 for a 2026-07-28 client. The tool list is 589 of that; the instructions are 220.
  • Sending takes one call. The arguments the agent writes and the result it reads come to 107 tokens together.
  • Help on demand: the op index is 375 tokens and one op's arguments 163. Neither is loaded until the agent asks, and a validation error includes the op's arguments, so a wrong first guess does not need a help call at all.
  • Waiting: an empty events/poll (42 tokens) costs about the same as a status check on a one-signer envelope (44). Polling either way costs roughly the same; the envelope.lifecycle poll costs more in total because it also reports who viewed and signed. What events add is pacing (nextPollMs), a cursor that never misses or repeats an event, and delivery that does not need the model to ask: push and webhooks reach the client directly, and how much of that reaches the model depends on the client.

Every response

Measured tokens per response
Responseo200k_basecl100k_baseBytesCounted
initialize (legacy handshake, includes instructions)2632621,028JSON of the result
Server instructions alone220221883the instructions string
server/discover (2026-07-28, includes instructions)3043031,162JSON of the result without _meta
tools/list (6 tools)5895772,414JSON of the result without _meta
tl_help {} (every op, one line each)3753741,262tool result text
tl_help {op:"create"} (one op with its args)163164520tool result text
tl_create create arguments (what the agent writes)6362237JSON of the tools/call arguments
tl_create create {send:true} result4443131tool result text
Same result, whole tools/call result object134132460JSON of the result: text block, resource_link and structuredContent
tl_read status (sent, 1 signer)4443131tool result text
tl_read list (1 envelope)202066tool result text
tl_read account313298tool result text
resources/read trustline://envelopes/{id}174171529JSON of the result without _meta
events/poll after the send (1 event)123121347JSON of the result without _meta
events/poll, nothing new4242121JSON of the result without _meta
events/poll after signing (viewed, signed, completed)316312935JSON of the result without _meta
events/poll envelope.completed after signing (1 event)116114328JSON of the result without _meta
tl_read status (completed)8483204tool result text
tl_read download (completed: 2 signed URLs)114113261tool result text
tl_read audit6767149tool result text
events/list (7 event types with schemas)1,4101,3465,852JSON of the result without _meta
Error: create without signers (bad_request, carries the op's args)133134432tool result text
Error: a send op on tl_create181862tool result text
Error: plan_required (account without a plan)9092358tool result text

How it stays small

Six tools, schemas on demand

The tool list has one tool per kind of effect (read, create, update, send, delete) plus tl_help. Each takes {op, args}, with the op names as an enum and args as a plain object, so no per-op schema sits in the list. Each op's arguments come from tl_help {"op"} as a short signature instead of JSON Schema:

tl_help, one op
tl_help {"op":"create"}
create {title, text|pdf(base64)|doc, signers:[{name,email,order?}], fields?, redirect?:https|{url,label?}, approval?, send?} -> envelope. text -> PDF with signature+date per signer.
args: {title:str,text?:str,pdf?:str,doc?:str,message?:str,signers:[{name:str,email:str,order?:int,role?:str}],fields?:[{kind:signature|initials|date|text|checkbox,signer:int,page:int,x:0..1,y:0..1,w:num,h:num,required?:bool,label?:str}],redirect?:str|{url:str,label?:str},approval?:bool,send?:bool,expiresInDays?:int,remindEveryDays?:int}

Tool annotations leave out hints that equal the MCP defaults, every op tool shares one output schema ({type: object}), and on 2026-07-28 the tool list is marked cacheable for an hour (ttlMs, cacheScope: public), so a client can skip fetching it again.

Results are ids and statuses

An op returns what the agent needs next and nothing it already knows: no echo of the title or document it just sent, no full envelope. turn: true marks the signer whose turn it is. Lists return three fields per envelope, and downloads return short-lived URLs rather than file bytes.

status
tl_read {"op":"status","args":{"id":"env_..."}}
{"id":"env_0012","status":"sent","signers":[{"id":"sgn_0009","email":"ada@example.com","order":1,"status":"notified","turn":true}]}
list
tl_read {"op":"list"}
[{"id":"env_0012","status":"sent","title":"Consulting agreement"}]
download (completed)
tl_read {"op":"download","args":{"id":"env_..."}}
{"pdf":"https://trustline.app/api/dl/env_0012/signed?t=...kfa6c57.f8e7b5088129c95b7117426dc737555ac9bed79fa5568fd4","cert":"https://trustline.app/api/dl/env_0012/certificate?t=...kfa6c57.d953845230dff4f89ed4f922ae0e9de632e325b9b7b4b285"}

Short instructions

The server instructions are 883 bytes. The first 512 characters stand alone (some clients show only those): what the server does, the tools, and that only a person approves or pays. Everything else is linked, not inlined.

Errors that save a round trip

A bad_request carries the op's argument signature, plan_required carries the checkout link to hand to the person, and rate_limited carries the wait. See the errors reference.

Reading the numbers

  • o200k_base and cl100k_base are OpenAI tokenizers. Claude, Gemini, Grok and other models use their own, and their counts will differ. Bytes are the same for every client.
  • Clients on protocol 2025-06-18 and later receive each op result twice in one response, as a text block and as structuredContent, plus a resource_link (the create result is 44 tokens as text, 134 as the whole result object). Which of these reach the model depends on the client.
  • A client also spends tokens on its own framing around tool calls and results. Those are not counted here: they depend on the client, not on Trustline.
  • Sizes grow with the envelope: more signers mean longer status results, and longer titles mean longer events.

Connect your agent and send a test envelope

Every plan includes the REST API and the MCP server, unlimited, with a 14-day free trial.