Get Scripted Decision Node Bindings
getScriptedDecisionNodeBindingsRetrieve available variables, functions, and import libraries for Scripted Decision Node scripts. This reference shows the APIs and classes accessible when writing journey scripts.
Instructions
Retrieve the available bindings (variables, functions) and allowed import libraries for Scripted Decision Node scripts. This is essential reference information when writing journey scripts - it shows what APIs and classes are available in the scripting environment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| realm | Yes | The realm to query |
Implementation Reference
- The tool definition and handler for 'getScriptedDecisionNodeBindings'. Makes a GET request to the AM 'contexts/SCRIPTED_DECISION_NODE' endpoint for a given realm and returns the available bindings (variables, functions) and allowed import libraries for Scripted Decision Node scripts.
export const getScriptedDecisionNodeBindingsTool = { name: 'getScriptedDecisionNodeBindings', title: 'Get Scripted Decision Node Bindings', description: 'Retrieve the available bindings (variables, functions) and allowed import libraries for Scripted Decision Node scripts. This is essential reference information when writing journey scripts - it shows what APIs and classes are available in the scripting environment.', scopes: SCOPES, annotations: { readOnlyHint: true, openWorldHint: true }, inputSchema: { realm: z.enum(REALMS).describe('The realm to query') }, async toolFunction({ realm }: { realm: string }) { try { const url = buildAMRealmUrl(realm, 'contexts/SCRIPTED_DECISION_NODE'); const { data, response } = await makeAuthenticatedRequest(url, SCOPES, { method: 'GET', headers: AM_SCRIPT_HEADERS_V2 }); return createToolResponse(formatSuccess(data, response)); } catch (error: any) { return createToolResponse(`Failed to get scripted decision node bindings in realm "${realm}": ${error.message}`); } } }; - Input schema (Zod) for the tool: requires a single 'realm' parameter that must be one of the allowed REALMS ('alpha' or 'bravo').
inputSchema: { realm: z.enum(REALMS).describe('The realm to query') - src/tools/am/index.ts:15-15 (registration)Re-exports the getScriptedDecisionNodeBindingsTool from the AM tools index barrel file.
export { getScriptedDecisionNodeBindingsTool } from './getScriptedDecisionNodeBindings.js'; - src/utils/amHelpers.ts:157-159 (helper)URL builder helper used to construct the full URL for the contexts/SCRIPTED_DECISION_NODE endpoint.
export function buildAMRealmUrl(realm: string, path: string): string { return `https://${aicBaseUrl}/am/json/${realm}/${path}`; } - src/utils/amHelpers.ts:46-49 (helper)API version headers (v2) used when making the request for scripted decision node bindings.
export const AM_SCRIPT_HEADERS_V2 = { 'accept-api-version': 'protocol=2.0,resource=1.0', 'Content-Type': 'application/json' } as const;