Code mode and tool execution
Discover app tools with search and describe, invoke them directly with call, or chain and filter results in a sandboxed JavaScript program with execute.
Executor’s MCP endpoint gives agents four execution tools—search, describe, call, and execute—plus skills for app documentation and resume for paused approvals. Use call for one or a few direct tool invocations, and use code mode (execute) when one tool’s output feeds the next call or when a large result needs to be filtered before entering the model’s context window.
- Available on: Local, Self-host, and Cloud (identical tool semantics; Cloud adds a 128 MB per-session memory ceiling).
- Prerequisites: An active MCP connection or
executorCLI session targeting a server with at least one deployed app and its required accounts linked. - Main command (CLI):
executor execute --code 'return await tools.search({ query: "apps" });'
You’ll know it worked when the response returns your program’s JSON return value along with a toolCalls summary.
Discovering tools with search and describe
search
search matches words against tool paths, descriptions, and labels. Each page returns matching tools with their exact callable path (tools.<app-slug>.<tool-name>), a description preview (up to 200 characters), and an input type preview (up to 1,000 characters, with inputTruncated: true when trimmed). Each app and its linked user accounts appear once per page.
Pass the returned next object as the entire input to fetch the next page; next is null on the final page. Discovery is never cached across app changes, so run search again after deploying an app or changing account links.
describe
Pass 1 to 20 exact tool paths from search to describe to retrieve complete descriptions, input types, and output types:
{ "paths": ["tools.github.listIssues", "tools.github.getIssue"] }
Any unrecognized path is returned in missing alongside closest matches. Inside an execute program, call tools.search(...) and tools.search.describe({ paths }) with the same shapes.
Direct calls with call
Use call when you do not need loops, conditionals, or filtering. Pass a single { path, input } or an array of independent calls in calls:
{
"calls": [
{ "path": "tools.vercel.listProjects", "input": {} },
{ "path": "tools.github.listIssues", "input": { "repo": "acme/widgets" } }
]
}
Multiple entries run concurrently and return outcomes in input order, each with ok and either value or error. A failed call does not cancel sibling calls. call returns full results without filtering; switch to execute when results are too large for model context.
Running programs with execute
execute runs a JavaScript snippet inside a sandboxed interpreter where every authorized app tool is an async function under tools.<app-slug>.<tool-name>.
How accounts are chosen
Every call inside call or execute uses the accounts linked to the app:
- Single-account requirements use the one account you linked on the app’s Accounts tab.
.many()requirements run against every account you linked.- App-scoped accounts (linked for everyone by people who can manage the app) are filled automatically for every caller.
Tool inputs cannot pick accounts at call time—passing $accounts fails with AccountChoiceUnsupported. To target a different account, link it on the app’s Accounts tab or copy the app and link the second account there.
Remote MCP tool results and isError
When an Executor app wraps a remote MCP server, the tool returns the remote server’s MCP shape: content, structuredContent, and isError. If a remote server duplicates structuredContent as JSON text inside content, Executor strips the duplicate copy—read structuredContent.
When a remote tool reports isError: true, the call returns that result instead of throwing so programs checking isError keep working, while toolCalls records the call’s outcome as failure. An outcome of success only means no tool error was reported; inspect the returned payload before assuming an external action completed.
Handling large results, images, audio, and files
Reduce large responses inside execute by mapping and returning only the fields the agent needs.
For binary outputs—screenshots, audio, or PDFs—Executor lifts matching blocks out of JSON so base64 data does not flood model context. Whenever execute, call, or resume returns a value containing:
{ type: "image", mimeType, data }{ type: "audio", mimeType, data }{ type: "resource", resource: { uri, mimeType, blob } }
with standard or URL-safe base64 bytes, Executor attaches each unique block as a separate MCP content item after the JSON text and replaces its bytes in JSON with a contentIndex pointing to that item. Inside an execute program, the original bytes remain intact so one tool’s output can be passed directly into another tool. Text resources stay in JSON.
From the CLI, executor call, executor execute, and executor resume write extracted binary blocks to files—in a new temporary directory or the directory passed to --files <dir>—and print each file’s path beside contentIndex.
Per-target execution steps
Local
Run directly from a shell without signing in:
executor execute --code 'const res = await tools.search({ query: "apps" }); return res.items.map((t) => t.path);'
You’ll know it worked when the CLI prints a JSON array of matching tool paths.
Cloud and Self-host
- Sign in once for tool commands with
executor login(Cloud) orexecutor login --host <your origin>(Self-host), or connect your MCP client to/mcp. - Run a program from a file (or pass source inline) and redirect large output to disk when needed:
executor execute --file program.js > result.json
You’ll know it worked when result.json contains your program’s JSON return value with exit code 0.
Example
Chain a search and a filtered projection inside one execute program so only project names enter context:
const listed = await tools.vercel.listProjects({});
return listed.projects.map((project) => ({
id: project.id,
name: project.name,
}));
From the CLI, pass the same script with --file:
executor execute --file list-projects.js --files ./out
Limits
Server limits are fixed and cannot be raised by an MCP client:
| Limit | Value | Notes |
|---|---|---|
| Program source size | 65,536 characters | Applies to execute source |
Tool calls per execute |
100 calls | Default server limit |
| Execution timeout | 5 minutes (300,000 ms) |
Excludes time spent waiting for approval or input; MCP clients often enforce shorter timeouts (commonly 60 s) |
| Cross-boundary value size | 32 MiB | Applies to a single value crossing between an app and Executor |
| Cloud MCP session memory | 128 MB | Very large values (e.g. 64 MiB) on Cloud can drop the response before the client’s timeout |
search page budget |
10 items default / 25,000 bytes | Descriptions cut to 200 chars; input types cut to 1,000 chars |
describe batch size |
1–20 paths | Extra paths must be split across calls |
- Sandbox environment: The
executeinterpreter has nofetch,process, filesystem access, timers, or module imports. Its only egress is calling authorized app tools. Limits are cooperative, not OS process isolation. - No silent truncation on recognized overflows: When Executor catches a value-size or memory limit, it returns an error naming the limit rather than a truncated payload.
- No restart recovery: If the server restarts while an
executeprogram is paused for approval, the session cannot be resumed and is not re-run automatically.