Skip to content

Make a file type searchable

inseam cannot index tab-separated tables (.tsv) well: it sees them as plain text. This example writes a converter that turns them into Markdown tables, submits it, reviews it, and searches a table. It uses curl against inseam’s MCP endpoint, so every call is visible. An agent makes the same calls.

You need an API token with search, read, write and connect:

Terminal window
export INSEAM_TOKEN="ias_…"
export INSEAM="https://inseam.io"
mcp() { curl -s "$INSEAM/mcp" -H "Authorization: Bearer $INSEAM_TOKEN" -H "Content-Type: application/json" \
-H "MCP-Protocol-Version: 2026-07-28" -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"$1\",\"arguments\":$2}}" \
| jq '.result.structuredContent'; }
Terminal window
mcp find_plugins '{"from": "text/tab-separated-values"}'

If an entry fits, install it with mcp trial_plugin '{"registry": "<hash>", "name": "TSV tables"}' and skip to step 5.

Save this as tsv-text.js:

const cells = (line) => line.split("\t").map((c) => c.replace(/\|/g, "\\|").trim());
export default {
manifest: {
contract: 3,
name: "tsv-text",
title: "Tab-separated tables as Markdown",
description: "Makes .tsv files searchable as Markdown tables.",
convert: [{ from: "text/tab-separated-values", to: "text/markdown" }],
},
convert({ text }) {
const rows = text.split(/\r?\n/).filter((l) => l.trim().length > 0).map(cells);
if (rows.length === 0) throw new Error("an empty table");
const width = Math.max(...rows.map((r) => r.length));
const pad = (r) => [...r, ...Array(width - r.length).fill("")];
const line = (r) => "| " + pad(r).join(" | ") + " |";
const head = rows[0];
return {
title: head.filter(Boolean).join(", ").slice(0, 120),
text: [line(head), line(Array(width).fill("---")), ...rows.slice(1).map(line)].join("\n") + "\n",
};
},
};

The title is the table’s own header row: it comes from the file’s structure, not from a sentence in it.

Terminal window
mcp trial_plugin "$(jq -n --rawfile code tsv-text.js '{
name: "TSV tables",
code: $code,
examples: [{ text: "bird\tcount\nheron\t2\n", expect: { contains: ["| bird | count |", "| heron | 2 |"], title: "bird, count" } }]
}')"
{ "accepted": true, "trial": { "trialId": "tr_…", "state": "queued", "slots": ["convert"], "target": "*", "codeHash": "9c1e…", "next": { "actor": "agent", "tool": "trial_status", … } } }

target: "*" means the whole network. Pass "for": "<host id>" for one host.

Terminal window
mcp trial_status '{"trialId": "tr_…"}' | jq '.trial | {state, checks: [.report.checks[] | {id, status, detail}]}'
{ "state": "passed",
"checks": [
{ "id": "examples", "status": "pass", "detail": "12 calls" },
{ "id": "corpus", "status": "pass", "detail": "12 calls" },
{ "id": "deterministic", "status": "pass", "detail": "12 calls" },
{ "id": "no-network", "status": "pass", "detail": "12 calls" },
{ "id": "budget", "status": "pass", "detail": "median 0 ms, slowest 21 ms" },
{ "id": "metadata", "status": "pass", "detail": "12 calls" } ] }

A failed check lists each problem with at, problem and fix. Fix the file and submit it again with "replaces": "tr_…".

Get the review’s checklist and the numbered code:

Terminal window
mcp review_plugin '{"trialId": "tr_…"}' | jq -r '.prompt'

Answer every check with evidence and line numbers, and add tests aimed at the code’s branches:

Terminal window
mcp review_plugin "$(jq -n --arg hash "9c1e…" '{
trialId: "tr_…", codeHash: $hash, verdict: "approve",
summary: "Splits the input on tabs and line breaks and writes a Markdown table of the same cells; nothing else.",
checks: [
{ id: "faithful", result: "pass", evidence: "The output is the input cells with pipes escaped and rows padded to one width; no text is added.", lines: [1, 13, 15, 16, 20] },
{ id: "title-and-tags", result: "pass", evidence: "The title is the header row joined with commas (line 19); there are no tags.", lines: [17, 19] },
{ id: "no-added-instructions", result: "pass", evidence: "The code adds only the Markdown pipes and the separator row; no words of its own.", lines: [16, 20] },
{ id: "no-state", result: "pass", evidence: "The only module-level binding is the pure function cells on line 1; nothing is assigned at module scope.", lines: [1] },
{ id: "deterministic", result: "pass", evidence: "No Date, Math.random or counter: the output is a function of text alone.", lines: [12, 13, 20] },
{ id: "bounded-work", result: "pass", evidence: "One pass over the lines and one over the cells; the width is the longest row, so padding is bounded by the input.", lines: [13, 14, 15] },
{ id: "options-safe", result: "pass", evidence: "The conversion declares no options and the code never reads input.options.", lines: [9, 12] },
{ id: "scan-addressed", result: "pass", evidence: "The scanner reported no findings; the only function the slot calls is convert on line 12.", lines: [12] },
{ id: "tests-aimed", result: "pass", evidence: "The tests aim at the empty-table throw, short rows that need padding, and a pipe inside a cell.", lines: [14, 15, 1] }
],
tests: [
{ text: "\n\n", why: "only blank lines is an empty table and is refused (line 14)" },
{ text: "a\tb\tc\nd\n", why: "a short row is padded to the widest row (line 15)" },
{ text: "a|b\tc\n", why: "a pipe inside a cell is escaped (line 1)" }
]
}')" | jq '.trial | {state, tests: .review.tests.passed}'
{ "state": "shadowing", "tests": true }

The converter now runs on up to 50 of your own .tsv files. Nothing is kept. A few seconds later:

Terminal window
mcp trial_status '{"trialId": "tr_…"}' | jq '.trial | {state, shadow: (.report.checks[] | select(.id == "shadow") | .detail)}'
{ "state": "installed", "shadow": "this network has no objects of text/tab-separated-values yet; live calls are checked from the first one" }

If your network asks a person to install converters, state is awaiting-install and next names the page.

Terminal window
curl -s -X PUT "$INSEAM/v1/o/pad/agents/me/birds.tsv" -H "Authorization: Bearer $INSEAM_TOKEN" \
-H "Content-Type: text/tab-separated-values" --data-binary $'bird\tcount\nkingfisher\t7\n'
curl -s "$INSEAM/v1/search" -H "Authorization: Bearer $INSEAM_TOKEN" -H "Content-Type: application/json" \
-d '{"q": "kingfisher"}' | jq '.hits[] | {address, title}'
{ "address": "inseam://n7q2…/pad/agents/me/birds.tsv", "title": "bird, count" }

Replace agents/me with your token’s own folder: the hosts tool returns it as padFolder. Read the table as Markdown too:

Terminal window
curl -s "$INSEAM/v1/o/pad/agents/me/birds.tsv?as=text%2Fmarkdown" -H "Authorization: Bearer $INSEAM_TOKEN"
| bird | count |
| --- | --- |
| kingfisher | 7 |