code
Execute TypeScript code with automatic tool discovery and parameter mapping using ncp.do().
Instructions
Execute TypeScript code with automatic tool discovery and parameter mapping.
PRIMARY METHOD - ncp.do(intent, params): Single-call execution with embedding-based param matching. No need to know exact tool names or param schemas!
ncp.do("send email", { recipient: "john@example.com", // Auto-maps to "to" title: "Meeting", // Auto-maps to "subject" message: "Let's meet" // Auto-maps to "body" })
Returns on success: { success: true, tool, result, paramMappings } Returns on failure: { success: false, tool, schema, hint }
schema shows actual params needed
hint suggests corrections
Retry with correct params!
FALLBACK - Direct namespace calls (when you know exact tools):
ncp.find("query"): Returns Tool[] with { toolName, schema, confidence }
namespace.tool(): Direct call e.g., gmail.send_email({ to, subject, body })
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | TypeScript code. Use ncp.do("intent", { params }) for automatic tool discovery and param mapping. | |
| timeout | No | Timeout in ms (default: 30000, max: 300000) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | No | Return value from code execution (any type) | |
| logs | No | Captured console output | |
| errors | No | Any errors that occurred | |
| executionTime | No | Execution time in milliseconds |