n8n-code-tool
Write JavaScript or Python for the n8n Custom Code Tool (@n8n/n8n-nodes-langchain.toolCode) — the AI-agent-callable tool, NOT the workflow Code node. Use when building a Code Tool attached to an AI Agent, writing code that an LLM will invoke, parsing the query input, returning a string result, defining an input schema for structured arguments (specifyInputSchema, jsonSchemaExample, DynamicStructuredTool), or troubleshooting errors like "Wrong output type returned", "No execution data available", "The response property should be a string, but it is an object", "Cannot assign to read only property 'name'", or an AI agent that refuses to call the tool. Covers the critical differences between Code node and Code Tool: return format (string vs [{json:{...}}]), unavailability of $fromAI/$input/$helpers in the Code Tool sandbox, naming rules for AI invocation, and when to use toolWorkflow/HTTP Request Tool instead.
Pinned to revision 02965226846a, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/n8n-code-tool/SKILL.md
- skills/n8n-code-tool/ERROR_PATTERNS.md
- skills/n8n-code-tool/INPUT_SCHEMA.md
- skills/n8n-code-tool/README.md
Every link opens the file at its source, pinned to the revision this page describes.