Table-result codec
Compact, lossless tables for agents.
tokade is a codec for table results. It sits between your data and the model. The wire is lossless, and the model only reads the cells, rows, or columns it asks for. Same data, far fewer tokens.
Encode
Encode once. Query it in place.
tokade reads each column and picks the tightest encoding for it, from a couple dozen schemes. This is a 1,000-row slice of Alibaba's public qps.csv trace. Every wire decodes back to the exact bytes you put in.
qps.csv · 1,000 rows
timestamp_anon,request_type,value 1662859176.0,API Requests,0.09000000000000001 1662859233.0,API Requests,0.09000000000000001 1662859404.0,Generative Requests,0.09000000000000001 1662859461.0,Generative Requests,0.09000000000000001 1662859461.0,API Requests,0.09000000000000001 1662859575.0,Generative Requests,0.09000000000000001 1662859689.0,API Requests,0.09000000000000001 1662859746.0,API Requests,0.18000000000000002 1662859803.0,API Requests,0.18000000000000002 1662859860.0,API Requests,0.18000000000000002 1662859917.0,Generative Requests,0.09000000000000001 1662859974.0,API Requests,0.09000000000000001 tokade wire
t=table n=1000 timestamp_anon|s|d1:B:E…;L:1*3,2,1*11,2*4,1,3*3,… request_type|s|B:…;M:118;API,Generative;… value|s|S:1000;0.09000000000000001;…
Querying · measured against reparsing CSV
Measured on Node v22 with tokade-mcp against the wire. The one loser is decoding the whole CSV first (1.48×), so don't do that on hot paths.
Tool access
One tool, in any MCP server.
tokade shrinks context. It doesn't make the wire readable, so don't make the model read it. Bind the wire server-side and expose tokade_table. The model asks for the exact cell, row, or column it wants, and the server decodes just that. Full decode is there for when the result is already small.
tokade isn't a database, a Parquet scanner, or an Arrow runtime. It encodes the bounded result you already decided to send. That's it.
mcp-server.ts
import { encodeCSV } from "tokade"
import { tokade_table, tokadeMcpTools } from "tokade-mcp"
// your query already filtered and limited this
const { wire } = encodeCSV(csv)
// drop wire so the model sends selectors only;
// the table never reaches the model's context
const { wire: _w, ...props } = tokadeMcpTools[0].inputSchema.properties
const selectorSchema = {
...tokadeMcpTools[0].inputSchema,
properties: props,
required: ["action"],
}
// bind the wire server-side
mcp.addTool("tokade_table", selectorSchema, (args) =>
tokade_table({ ...args, wire })) tokade_table → describe · preview · cell · row · column · project
Spec-first