The two tools
A client connected to t3cm sees two tools. search finds what to call, and
execute calls it. The model writes a short async arrow function for each.
search
search {code} runs an async arrow function whose only globals are
catalog and console, and returns {"result": ...} with the function’s
value, plus logs when the function logged anything.
catalog is an array of {name, kind, server, description, signature, inputSchema}, in this order:
- One entry per T3 tool:
kind: "t3",server: "t3", the bare T3 name.signatureis a generated TypeScript declaration with input and result types. - One per upstream tool:
kind: "mcp",serveris the upstream’s namespace, andnameisns.tool. The signature readsns.tool(...), orns["raw-name"](...)when the tool name is not an identifier. - The
wf,memandvarsAPI, withkindandserverset to"wf"or"mem".
Return only what you need. The point of the tool is to keep the catalog out of the model’s context:
async () => catalog.find(t => t.name === "t3_thread_send").signature
async () => catalog.filter(t => t.server === "cbm").map(t => t.name)
async () => catalog
.filter(t => /worktree/.test(t.name))
.map(t => `${t.name}: ${t.description.slice(0, 80)}`)
The API reference is the same set of signatures, generated from a snapshot of T3’s tools.
execute
execute {code, session?, timeout_ms?, thread?} runs an async arrow
function in a fresh sandbox and returns {"result": ...}, plus
"logs": [...] when the script logged anything.
The service strips TypeScript annotations and accepts loose input too:
markdown fences, export default, a named function, or a bare body whose last
expression becomes the result.
Execute globals lists the sandbox’s globals. In short,
t3 calls T3, each upstream has its own namespace, and mem, vars and wf
keep state between runs.
async () => {
const { threads } = await t3.thread_list({ allProjects: true, statuses: ["idle"], limit: 50 });
vars.idle = threads.map(t => t.threadId);
return vars.idle.length;
}
Filter and count inside the script, keep the bulk in vars, and return the
answer. Only the return value and the logs reach the model.
async () => {
const { threads } = await t3.thread_list({ allProjects: true, statuses: ["failed"], limit: 200 });
console.log(`${threads.length} failed threads`);
return threads.slice(0, 5).map(t => t.title);
}
Arguments
| Argument | Does |
|---|---|
code | The function to run |
session | Names the mem and vars namespace. It defaults to thread:<caller>, or default with no caller. |
timeout_ms | Wall-clock limit, default 60000, max 600000 (defaultTimeoutMs and maxTimeoutMs in the config) |
thread | The caller’s T3 thread id, for a connection that does not send the X-T3-Thread header |
The caller is the X-T3-Thread header, else the thread input, else none.
Results and errors
The service cuts results over 24,000 chars structurally. The output stays valid
JSON, the largest values go first, each cut carries a --- TRUNCATED ---
marker, and a truncated note says so.
Errors come back as isError with Error: <message> and any logs. The service
never echoes the script back, except that a syntax error quotes up to 160
characters of the line it failed on. A failed T3 or upstream call throws inside the script, so a
try/catch can handle it there.
A run that finds every slot taken waits up to runQueueMs (10 s) and then
fails with a busy error that says to retry. See
Troubleshooting.
From a shell
t3cm exec and t3cm search call the running service’s tools from a file or
stdin, for humans and scripts:
t3cm search - <<'JS'
async () => catalog.filter(t => t.kind === "mcp").length
JS