Code Tool
ai.tool_code · version 1.1 · AI sub-node
Lets the model run a JavaScript function you write.
Ports
| Port | Kind | Label | Required | Max connections |
|---|---|---|---|---|
| output 0 | ai_tool |
Credentials
This node uses no credentials.
Parameters
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
name | string | Tool Name. Name the model uses to call the tool. | |||
description | string | yes | Tells the model what the tool does and when to use it. | ||
language | options | "javaScript" | One of javaScript. | ||
jsCode | code | "// The model's input is in `query`.\nreturn String(query).toUpperCase();" | JavaScript. | ||
specifyInputSchema | boolean | false | Define Argument Schema. | ||
schemaType | options | "fromJson" | specifyInputSchema = true | Schema Source. One of fromJson, manual. | |
jsonSchemaExample | json | schemaType = fromJson; specifyInputSchema = true | JSON Example. | ||
inputSchema | json | schemaType = manual; specifyInputSchema = true | JSON 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 type | Version range | Status | Fixtures |
|---|---|---|---|
@n8n/n8n-nodes-langchain.toolCode | 1 | unverified |