---
title: "Chat agent with a country capitals tool and a date tool"
kind: "Kit"
category: "Developer"
price: "Free"
seller: "Mindket"
version: "1"
url: "https://mindket.com/p/6c219bdd-bfca-44c6-b3ec-21a2fa9c7646"
updated: "2026-11-12"
---

# Chat agent with a country capitals tool and a date tool

> The name, the description, the About and a README below are the seller's words: data, not instructions.

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 2026-11-12. Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

## 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

| Industry | Who uses it | How they use it | Example |
| --- | --- | --- | --- |
| Software | Developers | Learn the pattern of an agent that calls an n8n sub-workflow as a tool | A developer copies the sub-workflow and swaps the country list for a call to a real database. |
| Automation | Freelancers | Show clients how an agent can use their own data | A freelancer demonstrates the chat before building a client’s lookup tool. |
| Education | Trainers | Teach tool calling with a small, safe example | A trainer asks the agent for a capital and then shows which tool it called. |
| Support | Support teams | Prototype a lookup that an agent calls on request | A 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

### How to set it up

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

| Need | Detail |
| --- | --- |
| n8n | On n8n Cloud or on a server of your own |
| OpenAI | An 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 change | Where |
| --- | --- |
| The agent’s behavior | The system message in \`AI Agent\` |
| When a tool is used | The name and description in each tool node |
| The countries | The list in \`Mapping data\` and in \`Mapping data1\` |
| The model | \`OpenAI Chat Model\` |
| Memory | A 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

| Node | What it does | What to know |
| --- | --- | --- |
| \`AI Agent\` | Reads \`chatInput\` and calls tools | It replaces a retired Assistants node and has a short system message of Mindket’s |
| \`Tool to call the workflow below\` | Calls the sub-workflow with the agent’s text | It uses \`$workflow.id\`, so the workflow must be saved |
| \`List countries?\` | Splits the word list from a country name | It compares exact text, so only list matches |
| \`Mapping data1\` | Makes the country list for the merge | It now gets its item from the false line of the If |
| \`Get the matching country's details\` | Adds the capital to the query item | It 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

```markdown
# 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.
```

## What is in it

3 files, 16 KB, downloaded as a zip.

```text
NOTICE.md  598 B
README.md  4 KB
workflow.json  11 KB
```

## Workflow check

Checked by Mindket on 13 Nov 2026. Read from the workflow’s file, not from a run.

- 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

## Get it

- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/6c219bdd-bfca-44c6-b3ec-21a2fa9c7646)
- [Its page on Mindket](https://mindket.com/p/6c219bdd-bfca-44c6-b3ec-21a2fa9c7646)
