Function tool
The Function tool runs a small JavaScript function for each contact. Use it for light calculations, formatting, or branching data — not for hosting a full application.
Code runs in a sandbox on the runtime (not in the browser). console.log does not appear in Chrome DevTools; it appears in the pipeline journey and runtime logs.
Screenshot needed
Function tool step with the code editor showing main(params, context).
Where: Spinner builder → Function tool
Save as:
src/assets/screenshots/21-function-tool.pngRequired shape
Section titled “Required shape”You must define:
function main(params, context) { return { ok: true };}params
Section titled “params”params is an object with:
- Metadata fields from the data table (pipeline input)
- Outputs from earlier steps (for example
ai_response,disposition)
context
Section titled “context”| Field / method | Purpose |
|---|---|
recordId, jobId, projectId, organizationId | Identifiers |
log(message, extra?) | Write to journey / runtime logs |
vault(label) | Read a vault secret by label (async) |
Return value
Section titled “Return value”Return an object. Its keys merge into the record output for later steps. Avoid returning secrets.
Editor
Section titled “Editor”The builder uses a real code editor: syntax colors, line numbers, and Tab to indent.