Mindket

Chat agent with a country capitals tool and a date tool

Newversion 1 · updated

Overview

An n8n workflow that shows an AI agent using two custom tools in a chat. One tool returns the date and time, and the other looks up the capitals of fictional countries in a sub-workflow of the same file.

Chat agent with a country capitals tool and a date tool is an n8n workflow in the Developer category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

At a glance

Runs in
  • n8n Cloud: import the file and chat in the editor
  • Your own n8n server: the same file and steps
  • OpenAI: the chat model that decides when to call a tool
  • Your own tools: replace the two tools or the country list with your own data

Platform

Connects 1 app

How it works

Trigger

A chat message

It starts when you send a message in the n8n chat. It receives:

  • The text you typed, as chatInput

Actions

  1. An AI Agent with an OpenAI chat model reads the message
  2. The agent can call a code tool that returns the current date and time
  3. The agent can call a second tool that runs a sub-workflow in the same file
  4. The sub-workflow lists the fictional countries it knows when the query is list
  5. For a country name it returns that country’s capital, or says Capital not found
  6. The agent turns the tool’s answer into a chat reply

Result

A chat reply, with the date and time or the capital the tools found

Integrations

What you need before you start.

OpenAI

Language model

Runs gpt-5.6-terra, which reads the message and decides which tool to call.

NeedsOpenAI API key

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
10 steps, starting when another workflow calls it or on a Manual Chat event
AI
1 step calls an AI model: AI Agent
Sign-ins
Signs in to: OpenAI and Manual Chat
API keys
No API key is left in the file
Step types
Mindket’s checker reads all 8 of its step types

Read from the workflow’s file, not from a run.

About

What it is

This n8n workflow shows how to give an AI agent your own tools. A chat message goes to an AI Agent with an OpenAI chat model. The agent can call a code tool for the current date and time. It can also call a second tool, which runs a sub-workflow in the same file to list some fictional countries or return the capital of one. Thirteen nodes do the work, beside two sticky notes.

Who it suits

Developers who are learning how an agent calls a tool, and who want a small working pattern for a tool backed by an n8n sub-workflow. Skip it if you want a finished assistant for real data, because the country list is made up and sits in two Code nodes. It is a demo, not a product.

Who uses it, and how
IndustryWho uses itHow they use itExample
SoftwareDevelopersLearn the pattern of an agent that calls an n8n sub-workflow as a toolA developer copies the sub-workflow and swaps the country list for a call to a real database.
AutomationFreelancersShow clients how an agent can use their own dataA freelancer demonstrates the chat before building a client’s lookup tool.
EducationTrainersTeach tool calling with a small, safe exampleA trainer asks the agent for a capital and then shows which tool it called.
SupportSupport teamsPrototype a lookup that an agent calls on requestA team tests how an agent finds an item by exact name.

You need an n8n and an OpenAI key, and the imported workflow has to be saved before the tool works.

Where to use it

Any n8n, on n8n Cloud or on your own server, with an OpenAI account.

  • n8n Cloud: import the file and chat in the editor
  • Your own n8n server: the same file and steps
  • OpenAI: the chat model that decides when to call a tool
  • Your own tools: replace the two tools or the country list with your own data

Setup

Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. You add one credential and save the workflow.

What you need first
NeedDetail
n8nOn n8n Cloud or on a server of your own
OpenAIAn API key that can use gpt-5.6-terra
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. Add an OpenAI credential and select it in OpenAI Chat Model.
  3. Save the workflow, because Tool to call the workflow below calls it by its own ID.
  4. Open the chat from the button at the bottom of the screen and ask for the capital of Narnia.

How to use it

Type in the chat. Ask for the capital of a fictional country, ask which countries it knows, or ask for the date and time. Open the run afterwards to see which tool the agent called and what it sent.

What to change for a different result
To changeWhere
The agent’s behaviorThe system message in AI Agent
When a tool is usedThe name and description in each tool node
The countriesThe list in Mapping data and in Mapping data1
The modelOpenAI Chat Model
MemoryA memory node connected to AI Agent

Example

A user types “What is the capital of Narnia?”.

The agent calls the capitals tool with the word Narnia, the sub-workflow returns Cair Paravel and the agent says so in the chat. A user who types “Which countries do you know?” makes the agent call the tool with the word list. A country that is not in the list, or one spelled in a different case, comes back as Capital not found. Spelling matters.

For newcomers and experts

If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. An agent is a node that lets a language model decide which tools to use. This workflow gives the agent two tools and lets you watch how it picks one. Try it with the example question first.

For experts. The capitals tool is a Tool Workflow node that calls its own workflow, and the sub-workflow starts at Execute Workflow Trigger, which receives the agent’s text as query.

Where to look closer
NodeWhat it doesWhat to know
AI AgentReads chatInput and calls toolsIt replaces a retired Assistants node and has a short system message of Mindket’s
Tool to call the workflow belowCalls the sub-workflow with the agent’s textIt uses $workflow.id, so the workflow must be saved
List countries?Splits the word list from a country nameIt compares exact text, so only list matches
Mapping data1Makes the country list for the mergeIt now gets its item from the false line of the If
Get the matching country's detailsAdds the capital to the query itemIt matches the query with the country field, and an unknown name has no capital

Good to know

The Assistants API is retired, the lookup was broken in the original and the agent has no memory.

  • Assistants API: the original used an OpenAI Assistant node tied to an assistant in its author’s account. OpenAI’s deprecations page, read on 12 November 2026, says that API shut down on 26 August 2026, with the Responses API and the Conversations API as replacements. Mindket’s copy swaps in the agent node, backed by OpenAI Chat Model set to gpt-5.6-terra. The assistant’s instructions were not in the file, so the system message is Mindket’s
  • Lookup: in the original, Mapping data1 had no incoming line, so it never ran and every lookup answered Capital not found. Mindket’s copy feeds it from the false line of List countries?, and an offline test of the sub-workflow returns Cair Paravel for Narnia
  • Memory: the agent has none, as in the original, so each message is answered on its own
  • Spelling: a country must match the list exactly, including its case
  • Two lists: the countries sit in two Code nodes, so change both
  • Saving: the capitals tool calls its own workflow by ID, so save the imported copy first
  • Billing: OpenAI bills one model call for each step of the agent, and an answer that uses a tool needs at least two
  • Your data: your chat messages go to OpenAI
  • Credentials: the JSON holds none

README and files

README

Chat agent with a country capitals tool and a date tool

An n8n workflow that shows how to give an AI agent two custom tools. A chat message goes to an AI Agent that uses an
OpenAI chat model. One tool is a code tool that returns the current date and time. The other calls a sub-workflow in the
same file, which lists a set of fictional countries or returns the capital of one of them.

What is inside

  • workflow.json: the workflow as n8n exports it, 13 working nodes and two sticky notes. It holds no credential.
  • README.md: these notes.

What we changed from the original copy

  • The agent was an OpenAI Assistant node tied to an assistant in its author's own OpenAI account. OpenAI's deprecations
    page, read on 12 November 2026, says the Assistants API shut down on 26 August 2026, and names the Responses API and
    the Conversations API as its replacements. The node is now AI Agent (version 1.7) with an OpenAI Chat Model
    (version 1.2) set to gpt-5.6-terra. The assistant's own instructions lived in OpenAI's dashboard and were not in the
    file, so the agent has a short system message that names the two tools.
  • The country lookup never worked. Mapping data1 supplies the country list to the merge, and it had no incoming line,
    so it never ran, and every lookup returned Capital not found. List countries? now feeds it from its false line too.
    In an offline test of the sub-workflow, Narnia returns Cair Paravel.
  • The two sticky notes are reworded, and the pinned test item on Execute Workflow Trigger is removed.
  • The assistant ID and the credential reference are removed, so you pick your own credential.

Before you start

  • An n8n instance, on n8n Cloud or your own server.
  • An OpenAI API key that can use gpt-5.6-terra.

Set it up

  1. In n8n, create a workflow, open its menu and choose Import from File. Pick workflow.json.
  2. Add an OpenAI credential and select it in OpenAI Chat Model.
  3. Save the workflow. Tool to call the workflow below calls this same workflow by its own ID, and a new workflow has
    none until it is saved.
  4. Open the chat from the button at the bottom of the screen and ask, for example, what the capital of Narnia is.

How a run goes

  1. A chat message starts On new manual Chat Message, which hands it to AI Agent as chatInput.
  2. AI Agent asks OpenAI Chat Model what to do, and can call a tool up to 10 times, which is the node's default.
  3. Tool: Get current date and time, named date_tool, returns the current time as an ISO timestamp.
  4. Tool to call the workflow below, named country_capitals_tool, runs the sub-workflow in this same file with the
    agent's text as query. Execute Workflow Trigger starts it, and List countries? checks whether the query is
    exactly list.
  5. For list, Mapping data makes one item for each of the ten countries, Concatenate country names joins the names
    with line breaks, and Return country list returns them in response.
  6. For anything else, Mapping data1 makes the same ten items. Get the matching country's details matches the query
    with the country field, and Return specific capital returns the capital in response, or Capital not found.
  7. The agent turns the tool's answer into a chat reply.

Change the look

  • The agent's behavior: the system message in AI Agent.
  • What the agent knows about a tool: the name and description in Tool to call the workflow below and
    Tool: Get current date and time. The model reads them to decide when to call the tool.
  • The countries: the list in Mapping data and the same list in Mapping data1. Keep the two equal.
  • The model: OpenAI Chat Model.
  • Memory: connect a memory node to AI Agent to keep earlier messages.

Good to know

  • The Assistants API is retired, so the original node could not run today. gpt-5.6-terra is a current OpenAI chat model.
  • The agent has no memory, as in the original. Each message is answered on its own.
  • A lookup needs the country spelled and capitalized exactly as in the list. narnia finds nothing and returns
    Capital not found. The tool description tells the model to call list first when it is unsure.
  • The country list is in two Code nodes. Change both, or lookups and the list will disagree.
  • The tool calls its own workflow by ID, so it works after you save the imported copy.
  • OpenAI bills one model call for each step of the agent, and an answer that uses a tool needs at least two.
  • Your chat messages go to OpenAI.
Files
NOTICE.md  598 B
README.md  4 KB
workflow.json  11 KB

3 files, 16 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-12

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

Huashu Design

alchaincyf · Skill

Turns a one-line request in your AI agent into a finished design: a launch animation, a clickable app prototype, an editable slide deck, an infographic or a se…

New29.4k

Guizang PPT Skill

op7418 · Skill

Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…

New29.8k

Claude Code Skills & Plugins

alirezarezvani · Skill

Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…

New29.8k

Similar in Developer

See all in Developer

buzz

block · Kit

Self-hostable workspace where people and AI agents share the same rooms, built on a Nostr relay that logs every action as a signed event. For teams that want t…

New37.3k

plannotator

backnotprop · Kit

Opens your AI coding agent's plans, specs and code changes in a browser so you can annotate or comment on them and send the feedback straight back to the agent.

New10.5k

open-code-review

alibaba · Kit

Reviews Git changes with an AI agent that reads files and searches the codebase, then writes comments tied to exact lines. It suits developers who want automat…

New50.7k