How to Use the tools_documentation Tool to Discover n8n-mcp Capabilities
The tools_documentation tool is the central discovery mechanism of the n8n-mcp server that returns markdown-formatted documentation for any MCP tool, including itself, enabling AI agents and developers to explore capabilities without external API calls.
The n8n-mcp server exposes dozens of workflow automation tools, but discovering their parameters and use cases requires a built-in navigation system. The tools_documentation tool serves as the single source of truth for understanding what the server can do. Located in the czlonkowski/n8n-mcp repository, this self-documenting utility provides instant, in-memory access to every tool's specifications.
How the tools_documentation Tool Works
The tool operates through a three-layer architecture that aggregates definitions, formats output, and serves markdown strings without external dependencies.
Tool Registry Architecture
All tool definitions live in the src/mcp/tool-docs/ directory and are assembled into the toolsDocumentation object. The registry imports every tool's ToolDocumentation object via src/mcp/tool-docs/index.ts, creating a centralized lookup table referenced by tool name.
Documentation Formatter
The public API is exported from src/mcp/tools-documentation.ts through the getToolDocumentation function (implemented in lines 3-66). This wrapper looks up the requested tool in the registry and formats either an essentials or full view. A companion function, getToolsOverview, builds a concise quick reference listing every tool category, performance notes, and standard workflow patterns.
Documentation Depth Levels
The tool supports two depth parameters:
- essentials (default): Returns description, key parameters, one example, and quick tips.
- full: Returns complete parameter tables, return value descriptions, multiple examples, use-cases, best practices, pitfalls, and related tools.
Additionally, the function serves special topic guides for Code nodes via javascript_code_node_guide and python_code_node_guide.
Calling the tools_documentation Tool
All calls return a markdown string that can be rendered directly in a UI or displayed in a console. The tool is instant because all documentation lives in memory; no external API calls are performed.
1. Get a High-Level Overview
Start by calling the function without parameters to see all available tool categories and performance characteristics:
const overview = await tools_documentation();
console.log(overview);
2. Learn Tool Essentials
Retrieve the basic specification for any specific tool using the topic parameter:
const essentials = await tools_documentation({ topic: "search_nodes" });
console.log(essentials);
3. Access Full Documentation
Add the depth: "full" parameter to pull complete reference material including parameter schemas and multiple examples:
const fullDoc = await tools_documentation({
topic: "validate_workflow",
depth: "full"
});
console.log(fullDoc);
4. Retrieve Code Node Guides
Access language-specific guides for writing custom code inside n8n workflows:
const jsGuide = await tools_documentation({ topic: "javascript_code_node_guide" });
console.log(jsGuide);
5. Self-Document the Tool
The tool can document itself, which is useful for understanding its own parameters and behavior:
const selfDoc = await tools_documentation({
topic: "tools_documentation",
depth: "full"
});
console.log(selfDoc);
Core Implementation Files
The following files enable the tools_documentation tool to act as a single source of truth for n8n-mcp capabilities:
-
src/mcp/tools-documentation.ts: Contains the public wrapper functionsgetToolDocumentation,getToolsOverview, andsearchToolDocumentation. Implements the logic that formats and returns markdown documentation. -
src/mcp/tool-docs/index.ts: Aggregates every tool'sToolDocumentationobjects into the centraltoolsDocumentationregistry used by the wrapper. -
src/mcp/tool-docs/system/tools-documentation.ts: Defines the documentation structure for the tools_documentation tool itself, including its essentials and full sections. -
src/mcp/tool-docs/types.ts: Defines theToolDocumentationTypeScript interface, ensuring consistent shape for all tool documentation across the server. -
src/mcp/tool-docs/**/*.ts: Individual tool documentation definitions (e.g.,search_nodes.ts,validate-node.ts) that populate the registry.
Summary
- The
tools_documentationtool provides instant, in-memory access to all n8n-mcp capabilities without external API calls. - Documentation is stored in
src/mcp/tool-docs/and aggregated viasrc/mcp/tool-docs/index.ts. - The public API in
src/mcp/tools-documentation.tsoffers two depth levels: essentials and full. - The tool supports self-documentation and includes special guides for JavaScript and Python Code nodes.
- All responses are markdown-formatted strings ready for immediate rendering.
Frequently Asked Questions
What parameters does the tools_documentation tool accept?
The tool accepts two optional parameters: topic (a string specifying which tool or guide to document) and depth (either "essentials" for basic information or "full" for comprehensive documentation). When called without parameters, it returns a high-level overview of all available tools.
Can the tools_documentation tool document itself?
Yes. Calling tools_documentation({topic: "tools_documentation", depth: "full"}) returns the complete specification of the documentation tool itself, including its parameter schema, return format, and implementation details. This self-referential capability ensures AI agents can understand how to use the discovery system.
Where is the tool documentation stored in the codebase?
Tool documentation lives in the src/mcp/tool-docs/ directory, with individual files defining each tool's specifications. The src/mcp/tool-docs/index.ts file aggregates these into a central toolsDocumentation registry, while src/mcp/tool-docs/types.ts defines the TypeScript interfaces ensuring type safety.
Does calling tools_documentation trigger external API requests?
No. The tool operates entirely in-memory by referencing the pre-loaded toolsDocumentation registry assembled at initialization. This design guarantees instant response times and offline functionality, as all documentation content is bundled directly into the n8n-mcp server source code.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →