Measure the Tool-Schema Size of an Okibi MCP Server
AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.
Measure the Tool-Schema Size of an Okibi MCP Server
An MCP client sends a server's tool list to the model before any work starts, and that list takes up part of the model's context. This guide measures how large the tool list is for each surface of a generated Okibi MCP server: the tool count and the size of the serialized tools array. It is a size comparison between surfaces. It is not a measurement of the context a particular model or client actually spends, which needs that model's tokenizer or the client's own reporting.
What you will build
A script that starts the server on each surface, fetches tools/list, and reports the tool count and the size of the serialized tools array.
acme-orders mcp --tools <surface> -> tools/list -> count + bytes -> rough token estimate
AI Prompt
Using the generated acme-orders CLI, measure how large the tool list is on each MCP surface. Requirements: - For each of `compact`, `full` and `readonly`, start `./acme-orders mcp --tools <surface>` over stdio and call `tools/list`. - Report the tool count and the size of the JSON in bytes. Re-serialize the `tools` array compactly before measuring, and say so. Show bytes divided by 4 as an illustrative figure and say that it is not a tokenizer count. - Export ACME_ORDERS_API_KEY=demo-key before starting the server. - Run the verification step below before finishing.
Prerequisites
-
The Acme Orders example files,
openapi.json(a fictional orders API spec) andserver.py(a mock server for it). Download them into your working directory:curl -fsSLO https://raw.githubusercontent.com/heterochromatic/okibi-examples/main/acme-orders/openapi.json curl -fsSLO https://raw.githubusercontent.com/heterochromatic/okibi-examples/main/acme-orders/server.py
-
acme-ordersgenerated from the Acme Orders example spec and built with Go (okibi generate --spec ./openapi.json --name acme-orders --agent;okibi generate --agentdoes not download the CLI, so wait untilokibi status <run-id> --json(<run-id>isbuild.runIdfrom its output) shows"status": "succeeded", then runokibi pull <run-id>andgo build -o ./acme-orders ./cmd/acme-ordersinside the project), with the Acme Orders example API running (ACME_API_KEY=demo-key python3 server.py --port 8099). -
Python 3 and Okibi CLI
0.2.11.
1. Write the measurement script
Save it as measure.py in the folder that contains ./acme-orders (the path is relative).
import subprocess, json, os, select
os.environ["ACME_ORDERS_API_KEY"] = "demo-key"
def tools_for(surface):
p = subprocess.Popen(["./acme-orders", "mcp", "--tools", surface], stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True)
def rpc(i, method, params=None):
p.stdin.write(json.dumps({"jsonrpc": "2.0", "id": i, "method": method, "params": params or {}}) + "\n")
p.stdin.flush()
if not select.select([p.stdout], [], [], 10)[0]: raise SystemExit("no reply within 10 seconds")
return json.loads(p.stdout.readline())
rpc(1, "initialize", {"protocolVersion": "2025-03-26", "capabilities": {},
"clientInfo": {"name": "measure", "version": "0"}})
p.stdin.write(json.dumps({"jsonrpc": "2.0", "method": "notifications/initialized"}) + "\n")
try:
tools = rpc(2, "tools/list")["result"]["tools"]
finally:
p.terminate()
return tools
for s in ("compact", "full", "readonly"):
t = tools_for(s)
raw = json.dumps(t, separators=(",", ":"))
print(f"{s:9} {len(t):2} tools {len(raw):6} bytes serialized (bytes/4 = {len(raw)//4}, illustrative)")
2. Run it
python3 measure.py
compact 18 tools 22252 bytes serialized (bytes/4 = 5563, illustrative) full 18 tools 22252 bytes serialized (bytes/4 = 5563, illustrative) readonly 9 tools 8095 bytes serialized (bytes/4 = 2023, illustrative)
For this 9-operation API, compact and full return the same 18 tools. The read-only surface's serialized tool array is about 36 percent of that size (8,095 of 22,252 bytes). The script re-serializes the array with compact separators, so the byte counts are not the exact size of the server's tools/list response on the wire.
Verify the result
Re-run the script and check the counts: 18, 18 and 9. The byte sizes should match when the CLI version is unchanged.
How it works
Each tool's name, description and input schema are part of tools/list. The server includes built-in tools (context, search, sql, sync, export, import, send_feedback and two workflow tools) in addition to one tool per API operation. readonly removes the write tools.
Common issues
The script assumes clean output
It reads one line per response, so it relies on the server writing only JSON-RPC messages to standard output. That held here.
The token figures are illustrative
Bytes divided by 4 is a rough rule, not a token count, and the bytes are the re-serialized array, not the response as sent. For the tokens a model actually spends, count the same JSON with that model's tokenizer, or read the figure your MCP client reports.
compact is not smaller here
Okibi's help text says larger APIs get a core set plus search and describe tools on compact. This API is too small to trigger that, so the two surfaces match.
Smaller tool sets are a per-client choice
Claude Code is pointed at the full URL by Okibi's setup command because it searches tools. Pick the surface per client.
verification: status: verified tested_at: "2026-11-02" product_version: "okibi 0.2.11; acme-orders 1.0.0" command: "python3 measure.py" expected_result: "compact 18 tools 22252 bytes, full 18 tools 22252 bytes, readonly 9 tools 8095 bytes (serialized)"
