Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Code Tool

ai.tool_code · version 1.1 · AI sub-node

Lets the model run a JavaScript function you write.

Ports

PortKindLabelRequiredMax connections
output 0ai_tool

Credentials

This node uses no credentials.

Parameters

NameTypeDefaultRequiredShown whenDescription
namestringTool Name. Name the model uses to call the tool.
descriptionstringyesTells the model what the tool does and when to use it.
languageoptions"javaScript"One of javaScript.
jsCodecode"// The model's input is in `query`.\nreturn String(query).toUpperCase();"JavaScript.
specifyInputSchemabooleanfalseDefine Argument Schema.
schemaTypeoptions"fromJson"specifyInputSchema = trueSchema Source. One of fromJson, manual.
jsonSchemaExamplejsonschemaType = fromJson; specifyInputSchema = trueJSON Example.
inputSchemajsonschemaType = manual; specifyInputSchema = trueJSON Schema.

Import

Exported workflows that use these node types import to this node. Unverified ranges import with a parameter warning until parity fixtures confirm them; see Migrating.

Source typeVersion rangeStatusFixtures
@n8n/n8n-nodes-langchain.toolCode1unverified