Overview
Test whether an n8n AI Agent requests the right Markdown file after reading a JSON catalog of short summaries, by running questions with known answers and counting its file choices.
Problem or Objective
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- n8n
- Prerequisites
- An n8n instance that can read your test folder and a chat model connected to the AI Agent node.
How It Works
Put a handful of Markdown files in a folder your n8n instance can read, and write a JSON file giving each file name and a two-line summary. Build a sub-workflow that accepts a file name, rejects any name missing from the catalog, reads the file with the Read/Write Files from Disk node and returns its text (check which node converts the file to text in your version). In the main workflow, load the catalog and pass it to an AI Agent node with a chat model, with the sub-workflow connected through the Call n8n Workflow Tool. Instruct the agent to choose from the summaries, call the tool and report the file name it requested. Publish the sub-workflow before production runs. Approve the question list and the number of runs, then compare each requested file with the one you expected and count right, wrong and skipped calls.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up n8n.
- Connect the toolsConnect the tools this workflow relies on: n8n.
- Check the prerequisitesAn n8n instance that can read your test folder and a chat model connected to the AI Agent node.
- Gather your detailsCollect what the prompt asks for: JSON catalog content, Test question, Tool name, Reply when nothing fits.
- Run the starter promptPaste the starter prompt below into n8n and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at docs.n8n.io before you rely on it.
Practical Starter Prompt: Pick one file from a summary catalog
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
You are being tested on file selection. Here is a catalog of Markdown files with short summaries: [JSON catalog content]. Question: [Test question]. Choose the single file most likely to answer it, using only the summaries, and call the [Tool name] tool once with that exact file name. Reply with only the file name you requested. If no summary fits, do not call the tool and reply with [Reply when nothing fits]. Never request a name that is not in the catalog, and do not change any file.Approve the question list and run limit before a batch, keep the tool read-only, and compare each requested file with your expected answer.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. n8n's pages document an AI Agent node that decides which tools to call, a tool that runs another workflow and a node that reads files from disk. They do not measure file selection from summaries; your counts describe only your files, model and wording.
Limitations and Considerations
The file node's page says reachable paths depend on your deployment, that n8n Cloud limits it to paths under /home/node/ and that files it writes there may not persist. The tool page says a sub-workflow chosen from the database must be published for production runs or the call fails. Model calls may be billed, so set a run limit. File contents returned to the agent go to your model provider; use non-sensitive test files. Validate names so the tool cannot read anything outside the catalog. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Official Website
The official site of the main tool or project in this use case.
Related Videos
About n8n-io/n8n
Give Your Agent Tools (n8n Agents Course 5/7) (opens in a new tab)
Walkthrough of n8n by n8n: it is on the project’s own channel.
Watch on YouTube (opens in a new tab)About n8n-io/n8n
n8n AI Nodes: Connect OpenAI, Claude, and Local Models (opens in a new tab)
Walkthrough of n8n by AI Daily Lab: its description links the GitHub repository.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- AI Agent | Nodes | n8n Docs (opens in a new tab)
Project documentation · docs.n8n.io · Undated · Source checked 2 Dec 2026, 13:21 UTC
What this source supports
- Connect a chat model and one or more tools, and the agent decides which tools to call to complete a task.
- You must connect at least one tool sub-node to an AI Agent node.
- Call n8n Workflow Tool | Nodes | n8n Docs (opens in a new tab)
Project documentation · docs.n8n.io · Undated · Source checked 2 Dec 2026, 17:10 UTC
What this source supports
- The Call n8n Workflow Tool node is a tool that allows an agent to run another n8n workflow and fetch its output data.
- Read/Write Files from Disk | Nodes | n8n Docs (opens in a new tab)
Project documentation · docs.n8n.io · Undated · Source checked 2 Dec 2026, 17:10 UTC
What this source supports
- Use the Read/Write Files from Disk node to read and write files from/to the machine where n8n is running.
- The paths this node can access depend on your n8n deployment.

