execute_code
Run TypeScript/JavaScript in an isolated sandbox to orchestrate MCP tools, filter intermediate data in memory, and return only final results to reduce token usage.
Instructions
Execute TypeScript/JavaScript code inside an isolated sandbox to orchestrate tools and filter data. Intermediate data stays in memory; return only the final result to save tokens.
Available APIs on the global mcp object:
/**
* OpenCodeMode Injected API
* Every function executes through the secure IPC bridge to the downstream MCP server.
* Intermediate data stays inside sandbox memory; return only the desired result.
*/
declare namespace mcp {
namespace demo {
/**
* Returns company employees with their department, salary, and performance ratings
* @param args.department Optional filter by department (e.g. 'Engineering', 'Sales', 'Product')
*/
function list_employees(args?: {
department?: string;
}): Promise<any>;
/**
* Awards an annual performance bonus to an employee
* @param args.employeeId Employee ID (e.g. EMP-01)
* @param args.amount Bonus amount in USD
*/
function award_bonus(args: {
employeeId: string;
amount: number;
}): Promise<any>;
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Async JavaScript/TypeScript snippet to execute (e.g. `const res = await mcp.my_tool(); return res.filter(...);`) |