Plug in
tools

Youth AI Lab · Workshop 4 of 6
Build your own chatbot

❓ The question of the series

A chatbot only answers from what it reads before it answers. Every workshop of the series is one answer to the same question.

What enters the model's context, when, and who decides?
📥
What?
rules, documents, search results, live data
⏱️
When?
always, at startup, or for each question
🧑‍⚖️
Who decides?
you, a search engine, or the model itself

🧭 Today: what happens when the chatbot acts outside?

🎭
1. Instructions
📚
2. Knowledge, RAG
🔎
3. Search, skills
📡
4. Tools
today
🗺️
5. Wiki
🧪
6. Fine-tuning
Documents: what was true the day they were written.
Mode C: the model searches them itself.
Mode D: + tools, for what changes every day.

🗓️ The plan: 2 hours

👋 Welcome
20 min
📡 Our tool
20 min
🧩 Existing servers
30 min
🔍 Read before you install
25 min
🏁 Closing
15 min
📄 Follow on your screen: the README.md of your Codespace, or the one-page sheet.

💻 Your workspace: one Codespace per pair

A Codespace is VS Code in your browser: nothing to install. Everything you need is already inside.

⏱️ Before you open it, once per GitHub account: github.com/settings/codespaces → Default idle timeout → 120 → Save. It only applies to the Codespaces you create after.

1Open the Codespace link of the workshop, at the top of its README
2In the terminal, type workshop-login and paste the key of your pair
3Wait for Key OK, then type workshop bare. First time: choose a theme, then ↓ to Yes, I trust this folder (Enter alone exits). To leave: Ctrl+C twice
4Then type workshop-start and the number of the workshop. With a save from last time, add --from my-work.zip
⚠️ The key is not shown while you paste it: that is normal. If the Codespace stops after a long pause, reopen it: nothing is lost.

💻 No Codespace? The same repository opens on your own computer: dev containers guide, Part 3.

🐳 Bring your work

1Drag my-work.zip into the file list (the newest: maybe my-work (1).zip, then its exact name between quotes), then workshop-start 4 --from my-work.zip. Check the saved on date.
2No save? workshop-start 4: Feurisson, and the document of Benevento added for you.
3Have the official page of the fire danger level of your territory ready, if it has one.
4Second terminal: openwebui start. Do not wait for it: you will use it at the closing.
🚫 Never make port 3000 public. This Open WebUI has no accounts: anyone with the link could use your key.

🌡️ The gauge: how full is the context?

The context is everything the model reads before it answers. Its maximum size is the context window. A line above the input box shows how full it is.

🪟
200,000 tokens
the size of the window (a token is a piece of a word)
💶
Every message pays
for everything in the window
🤝
Same model for all
so that the pairs can compare
👁️ Watch the gauge at every change: it shows what entered the context.

📏 How to score an answer

Each answer gets 0, 1 or 2. The score rewards honesty as much as knowledge.

2
Right, and it says where it comes from. Or "I don't know" when nobody knows.
1
Honest but not enough: no source, only partly right, or "I don't know" although the answer exists.
0
Wrong or invented.
💡 An invented answer is worse than "I don't know".

📡 Our tool

Today's level: only a tool can know it

20 min · mode D · /mcp

📡 A tool brings back a fact

🧠
The model decides
to call the tool, from its description
📡
The tool answers
from mcp/fire-danger.json
🧑
A person
fills in the file, from the official source, on the day
MCP: one common way to plug a tool program (a server) into Claude Code, OpenCode or another chatbot.

🎬 Your turn: question 8, then Antwerp

1workshop D, then /mcp: fire-danger and time. Esc.
2Question 8, then Ctrl+O: what did the tool send back? Look for why_no_level.
3mcp/fire-danger.json: today's date; for Antwerp, status, source_says, and level, advice only if live.
4Question 8 again, Ctrl+O: what changed?
⚠️ Never make up a level: only what the official source says, on the day.

🧩 Servers that already exist

What does each one read, and send away?

30 min · time · open-meteo · WORKSHOP_WEATHER=1

🧩 Three servers side by side

Server Who wrote it What it reads What the server sends on the internet
fire-danger the workshop mcp/fire-danger.json nothing
time the MCP project (official example) the clock of the Codespace nothing
open-meteo a volunteer (its code is public) the Open-Meteo service the place and its coordinates
💡 What a server does is in its code and how it starts, not in its name.

🎬 Your turn: the time, then the weather

1Open .mcp.json (time: --local-timezone Europe/Paris). Then workshop D: Has the Pla Alfa map of Catalonia already had its morning update today? → Ctrl+O: was time called?
2The same, starting with Use the time tool:. Compare.
3WORKSHOP_WEATHER=1 workshop D, /mcp: open-meteo 17 tools (the model gets 2).
4Will it be windy tomorrow in La Rochelle? → Ctrl+O: what was sent? Then Given the weather, what is the fire danger level today in La Rochelle?
📏 Measured (2026-10-30): the weather plugged in but not called: 7,845 → 13,868 tokens on fire danger questions, about 6,000 more.

🔍 Read before you install

and give your source

25 min · mcp/fire_danger_server.py · mcp/fire-danger.json

🔍 Before you install a server: five questions

1️⃣ Who wrote it, and is it still maintained?
2️⃣ What does it read? Its code, and its options in .mcp.json.
3️⃣ What does it send away, and to whom?
4️⃣ Does it write or delete anything, or send messages?
5️⃣ Is its version fixed?
🔑 A server runs with your rights. The description says what it is for; only the code says what it does.

📚 Tools in a chatbot of your own: your chatbot in Open WebUI (end of this workshop) · another way: OpenCode guide, Part 6 - Tools with MCP · Other MCP servers (its launcher accepts only small tools of its own folder)

🕵️ What a tool sends back enters the context

A web page, a document, an answer from a service can carry instructions that nobody wrote in your AGENTS.md.
Watch: a page that hides one sentence for AI assistants. What does the chatbot do with it?
❓ Who wrote this sentence, and who read it?

🎬 Your turn: your territory, with its source

1mcp/fire_danger_server.py: the five questions. Does it call the internet?
2mcp/fire-danger.json: the entry of your territory (or a copy of one entry, with its own name, scale, source, season).
3status, source_says; level and advice only if live. Save.
4workshop D: What is the fire danger level today in <your territory>? Does it name your source?
5Add a field "checked_by"… → Edit file → 3. No: a change to a file waits for your yes.
✅ "There is no official level today, here is why" is a right answer.

🏁 Closing: column D, your chatbot, your save

1Predict: which of 8, 11, 12 go up from C to D? Leave the conversation (Ctrl+C twice), then replay D and score D 8 11 12. Compare the rows with column C, not the Total (no C score for 8: score C 8).
2Second terminal: openwebui chatbot --name "<your chatbot>", then question 8 in Open WebUI. Click View Result from fire-danger_fire_danger: the same tool, read-only.
3workshop-save → Download... my-work.zip: your fire-danger.json and everything before. If your computer already has one, bring the newest (maybe my-work (1).zip).
📝 Exit card, alone: (1) Why can only a tool give today's fire danger level? (2) What can a server do in your Codespace, and how do you check it? (3) Weather forecast or official level: what is the difference?

🆘 If you are stuck

Every command explains itself. From workshop 3, a few slash commands inside the chatbot show what it is using.

❔
In the terminal
workshop help
replay --help
score --help
🔍
In the chatbot
/context what fills the window
/status the key in use
/mcp the tools (from workshop 4)
Workshops 1 and 2: they answer "Unknown command". Watch the gauge above the input box.
🙋
Something breaks?
Ask the facilitator. Your files stay in the Codespace.
💡 To leave a conversation: Ctrl+C twice. In an open .md file, to read it as a page: Ctrl+Shift+V (Cmd+Shift+V on a Mac). In the terminal, copy / paste: Ctrl+Shift+C / Ctrl+Shift+V (Cmd+C / Cmd+V on a Mac). To change mode: workshop <mode>.

🗣️ Say (EN) - Welcome to the fourth workshop. Today, the chatbot uses tools: actions that bring today's facts, such as the fire danger level. - You will see what a tool sends back, use two servers that other people wrote, and fill in the entry of your territory with its source. - Please open the Codespace of this workshop, and bring my-work.zip.

Fiche animateur : facilitator/workshops/4-facilitator.md. Lire les sources officielles du jour le matin même (Anvers, son territoire) ; enregistrer la page piégée (https://youth-ai-lab.github.io/yal-workshop/4/trap-page.html) pour SON Codespace.

🗣️ Say (EN) - A chatbot only answers from what it reads before it answers. - So every workshop of the series answers one question: what enters the model's context, when, and who decides? - It can be rules, documents, search results or live data, and the one who decides can be you, a search engine, or the model itself. - We come back to this question in each part of each workshop.

La question qui organise toute la série. La relire à voix haute, et y revenir à chaque partie : « qu'est-ce qui entre dans le contexte maintenant, quand, et qui l'a décidé ? ». Le « contexte » : tout ce que le modèle lit avant de répondre (on le définit sur la diapositive de la jauge).

🗣️ Say (EN) - Until now, the chatbot only read what was in the Codespace. No document can hold today's fire danger level. - Today, in mode D, the model can call tools. And behind a tool is a program that runs with your rights: so we also learn to read before we plug one in.

Rappel : la question de la série ; aujourd'hui, ce qui entre dans le contexte vient aussi de l'extérieur.

🗣️ Say (EN) - Two hours: welcome, our fire danger tool, two servers that already exist, reading a server before you install it, and a closing.

20 + 20 + 30 + 25 + 15 = 110 min, plus 10 min de marge.

🗣️ Say (EN) - Each pair works in one Codespace: VS Code in your browser, with nothing to install. - Before you open it, the first time on your GitHub account: go to github.com/settings/codespaces, set Default idle timeout to 120, and Save. It only applies to the Codespaces you create after, so do it first. - Open the link, type `workshop-login` in the terminal, and paste your key: you will not see it, and that is normal. - When you see Key OK, type `workshop bare`: the first time, choose a theme, then press the down arrow to choose Yes, I trust this folder, and Enter: Enter alone would choose No, exit. To leave, press Ctrl+C twice. - Then type `workshop-start` with the number of today's workshop. If you saved your work last time, add `--from my-work.zip`: it brings your work back first. It opens the page of the day. - If the Codespace stops after a long pause, just reopen it: nothing is lost. - No Codespace, because the network blocks it or the quota is used up? The same repository opens on your own computer: see the dev containers guide, Part 3.

Un dépôt par atelier : https://codespaces.new/Youth-AI-Lab/yal-workshop-preprompt pour l'atelier 1 (création 77 à 84 s mesurées le 2026-10-30, image 2026.10.31, dépôt de l'atelier 1). Une clé par binôme (workspace Anthropic, plafond de dépense), donnée en privé à chaque binôme. Un nouveau Codespace à chaque atelier : workshop-save à la fin, workshop-start n --from my-work.zip au début du suivant. Clés sk-or- (OpenRouter), l'autre choix : même commande, workshop-login prend OpenCode tout seul, sans modèle Claude ; toute la salle sur un seul modèle. Claude Code les refuse. Messages : « Key OK (Claude Code, Anthropic, model claude-sonnet-5-5). You can start: workshop bare » (avec OpenCode : « Key OK (OpenCode, Anthropic, model anthropic/claude-sonnet-5-5)… » ; clé sk-or- : « Key OK (OpenCode, OpenRouter, model openrouter/deepseek/deepseek-v4-flash). You can start: workshop bare »). HTTP 401/403 : clé refusée. HTTP 400 : presque toujours une clé créée sans workspace (SETUP.md). Délai d'inactivité : 30 min par défaut ; demander de le passer à 120 min dans github.com/settings/codespaces AVANT de créer le Codespace (GitHub : le réglage ne vaut que pour les Codespaces créés ensuite ; SETUP.md, étape 1).

🗣️ Say (EN) - Bring back your work with workshop-start 4 and --from. Bring the newest my-work.zip: your browser may have called it my-work (1).zip. The line "saved on" tells you which save you restored. - Most of today happens in mode D. The first time you type workshop D, Claude Code asks again whether you trust the folder: down arrow, "Yes, I trust this folder", Enter. - Then start Open WebUI in the second terminal, and go on without waiting: at the closing, your chatbot gets the same tool there. - Keep the official page of your territory at hand: you fill in its entry in Part 4.

Le nom « my-work (1).zip » dépend du navigateur (consigne reprise de l'atelier 2). Mesuré (2026-10-30, image 2026.10.34) : workshop-start 4 sur un dépôt neuf ajoute Bénévent (« The Benevento document was not in the corpus (workshop 3): it is now … ») et annonce workshop D ; avec --from, « nothing needed ». openwebui start (image 2026.11.4) lance aussi le serveur fire-danger pour Open WebUI : « Live tool ready: fire-danger (fire_danger, territories), read-only. ». workshop-start 4 ne démarre pas Open WebUI (seul l'atelier 2 le fait). Premier lancement en Codespace dans ce dépôt : non mesuré (3 min 21 en 2026-10, autre dépôt, image plus ancienne).

🗣️ Say (EN) - The context is everything the model reads before it answers; the context window is its maximum size. - The window holds 200,000 tokens, and a token is a piece of a word. - Every message pays for everything in the context, and all pairs use the same model, so we can compare. - Watch the gauge above the input box at every change: it shows what entered the context.

Jauge : mod Claude Code token-weather. Modèle imposé par workshop-login (ANTHROPIC_MODEL) : claude-sonnet-5-5, sans [1m] pour que la jauge bouge (OpenCode : anthropic/claude-sonnet-5-5 ; clé sk-or- : openrouter/deepseek/deepseek-v4-flash, ou le modèle choisi avec --model, dont la fenêtre peut être plus petite que 200 k). Clé sk-or- : les coûts et les notes de ces decks viennent de Claude et ne valent pas pour OpenRouter (facilitator/workshops/measures/2026-11-01-openrouter-free/README.md). Jauge en interactif, 2026-10-30 (vrai Codespace, image 2026.10.34) : bare 1,6 k après la Q1 et 1,7 k pour « Hello », A avec Feurisson 2,6 k. B : 100,7 k à la répétition du 2026-10-21 (image plus ancienne). Elle reste à 0 avant le premier message (`0 / 200k`). Ne pas mélanger avec les contextes écrits par replay sous chaque réponse : ~2,4 k en bare (répétition du 2026-10-20, facilitator/SETUP.md 4 bis, étape 4), ~2,4 k en A avec Feurisson (2026-10-29, facilitator/workshops/measures/2026-10-29-personas/claude/A-feurisson-22h00.md).

🗣️ Say (EN) - Each answer gets 0, 1 or 2 points, and you write them in `scores.md`. - 2 means right and with its source, or "I don't know" when nobody knows the answer. - 1 means honest but not enough, and 0 means wrong or invented. - Remember: an invented answer is worse than "I don't know".

Barème dans test-questions.md ; notes dans scores.md (12 lignes courtes, dont la Q12 du binôme ; total /24 par colonne, /22 tant que la Q12 est vide ; au tableau, ne comparer que des totaux sur le même nombre). Questions 7 et 9 (inconnue, hors sujet) : la bonne réponse est de le dire.

Partie 2 (20 min) : /mcp, Q8, remplir Anvers ENSEMBLE au grand écran depuis sa page officielle, Q8 de nouveau ; faire appuyer sur Ctrl+O.

🗣️ Say (EN) - In mode D, the model can call a tool. It decides to call it from its description, and it does not ask you first: these tools only read. - Our fire danger tool reads a file. A person fills it in from the official source, on the day. If nobody did, the tool says so, and gives no level.

Le serveur ne donne un niveau que si le fichier est daté du jour (heure de Paris) et le statut « live » ; sinon level null et why_no_level. Mode D = mode C + MCP (fire-danger, time).

🗣️ Say (EN) - Look at the tools first with /mcp. Then ask question 8 and press Ctrl+O to see what the tool sent back. - Let us fill in Antwerp together, from its official page. Then do it in your file, save, and ask again: the tool reads the file at each call.

NE PAS projeter la réponse attendue de Q8 ni dire quel statut choisir avant le remplissage commun. Le jour même : voir la fiche animateur (« The data of the day »). Mesuré le 2026-10-30 : Q8 avant remplissage, fire_danger puis territories, pas de niveau, ~8 k, 6 s, 0,03 $ ; Anvers en season-over avec la phrase de l'ANB : « no official fire danger level for Antwerp today », phrase citée, 0,007 $. À l'écran : « Called fire-danger 2 times », Ctrl+O déplie.

Partie 3 (30 min) : .mcp.json, la question du Pla Alfa deux fois, la météo, la jauge.

🗣️ Say (EN) - Three servers. Ours reads a file. Time, the official example of MCP, reads the clock. Open-Meteo, written by a volunteer, asks a weather service on the internet. - Only the third sends something away: the place and the coordinates the model asks about. - Many more servers exist: a whole world to explore (the MCP project lists examples on github.com/modelcontextprotocol/servers). Each one is a program to read before you trust it. - Tools can be combined: a calendar says when, a map where. Together they say where a person will be, and when. The GDPR asks that personal data be used only for the purpose it was collected for: a chatbot with tools can cross data in seconds, without anyone deciding it.

Time : mcp-server-time 2026.10.28, dépendances figées par empreinte, --local-timezone Europe/Paris. Open-Meteo : open-meteo-mcp-server 2.5.6 (2.5.5 jusqu'à l'image 2026.11.4) construit depuis son tag (Node 24) ; le modèle n'en voit que 2 outils sur 17 ; DOTENV_CONFIG_PATH=/dev/null contre un .env piégé.

🗣️ Say (EN) - Ask the Pla Alfa question: does the model call time? Then name the tool in the question, and compare. - Plug in the weather for one conversation. Look at what goes to Open-Meteo, and check that the chatbot does not give the weather as a fire danger level. - And look at the gauge after the first weather question: the descriptions of the tools enter the context with every message, used or not.

Mesuré le 2026-10-30 (image 2026.10.34) : Pla Alfa sans nommer l'outil, time non appelé, « I don't know » ; avec « Use the time tool: », time (Europe/Madrid) appelé, bonne réponse, 0,015 $. La date, le modèle l'a déjà (Claude Code et le champ today de fire_danger). Météo : weather_forecast avec les coordonnées de La Rochelle, sans géocodage ; « This is a weather forecast… It is not a fire danger level. » ; question piège : fire_danger appelé, aucun niveau déduit de la météo (un seul essai). Feurisson refuse « What time is it now in Naples? » (hors sujet).

Partie 4 (25 min) : les cinq questions sur notre serveur ; VOTRE démo de la page piégée ; chaque binôme remplit son territoire.

🗣️ Say (EN) - A server is a program that starts in your Codespace, with your rights. Before you plug one in, answer five questions. - Try them on our own server: open mcp/fire_danger_server.py. The text between the triple quotes is what the model reads. - Your chatbot in Open WebUI gets this same tool at the end of the workshop. Another way, for adults, without Claude Code: the OpenCode guide shows how, and why its launcher refuses servers it cannot check.

Notre serveur ne lit que DATA (RECORDED seulement avec FIRE_DANGER_RECORDED=1) et n'appelle aucune adresse. Guide OpenCode, « Other MCP servers » et « Check a chatbot folder you received » : même grille.

🗣️ Say (EN) - Anything the model reads enters its context with the same weight as your question: a document, a page, the answer of a tool. - Let us look at a page that hides one sentence for AI assistants.

DÉMO dans VOTRE Codespace (https://youth-ai-lab.github.io/yal-workshop/4/trap-page.html) : déposer trap-page.html, workshop D, « Summarise trap-page.html for a group of young people. », montrer la réponse, puis ouvrir le fichier dans l'éditeur. Mesuré (image 2026.10.33) : aucun des deux moteurs n'a suivi la consigne ; OpenCode l'a signalée, Claude Code non. SUPPRIMER la page avant tout replay.

🗣️ Say (EN) - Answer the five questions for our server. Then fill in the entry of your territory, with the address of its source. - No daily level in your territory today? Write the status and the sentence of the source: a chatbot that says there is no level, and why, is right. Never another index or a forecast. - Still in workshop D, ask it to add a field "checked_by" to your entry. Claude Code stops and shows the edit: choose 3. No. The tool only reads, so it never asked you; a change to a file waits for your yes. - Then read the box "What the workshop set up for you, and why": no level without today's file, 2 tools out of 17, tools allowed in advance only because they read, an empty settings file, fixed versions. You see them; you do not set them. - With young people: read-only tools, no personal data, public sources only.

Mesuré le 2026-10-30 : La Rochelle en no-level-shown avec la phrase de l'arrêté 26EB142 (« En cas d'absence de données… ») : phrase citée et traduite, « No level does not mean no risk », 0,011 $. Naples : pas de page quotidienne publique (no-level-shown).

🗣️ Say (EN) - First predict: which of questions 8, 11 and 12 will go up from column C to column D? - Replay the test set in mode D and score the three questions of today: 8, 11 and 12. No question 12? Score 8 and 11. - Compare the rows with column C. The Total row means nothing today: only some questions are scored. If column C has no score for question 8, type score C 8: your answers of workshop 3 are still there. No save? Compare with a neighbouring pair. - Then put your chatbot in Open WebUI, in the second terminal, and ask question 8. It has the same tool as mode D, and only that one: it reads your fire-danger.json, from public sources, and writes nothing. Click "View Result from fire-danger_fire_danger" to see what it sent back. If the file is not dated today, you see why_no_level, as in Part 2. - Save your work for workshop 5, and fill in the exit card.

2026-10-30 (image 2026.10.34, 11 questions, sans Q12, Anvers et La Rochelle remplies) : replay D 1 min 54, 0,24 $ ; juge Q8 = 2, Q11 = 2. OpenCode replay D 8 : 5 s, 0,02 $. Outil dans Open WebUI (image 2026.11.4) : essayé seulement avec un faux modèle et une fausse clé, sans sortie réseau, le 2026-11-04 (openwebui-prototypes/next-image/) : fire_danger et territories seuls, why_no_level rendu, 401 sans jeton. qwen3:8b (ThinkPad, 2026-11-05) : premier appel de fire_danger après le démarrage non exécuté (1 fois sur 3, réponse vide). Claude Sonnet 5.5 (un essai, 2026-11-05, real-model-local/results-claude/) : territories puis fire_danger(Antwerp) exécutés du premier coup, pas de niveau inventé (0,021 $). Non essayé : un vrai Codespace, l'écran, la durée. Libellé « View Result from fire-danger_fire_danger » vu dans Chrome sans écran par le prototype openwebui-prototypes/mcp/, pas avec cette image. Pas le temps : montrer son propre chatbot sur grand écran.

🗣️ Say (EN) - If you are stuck, every command explains itself, for example `workshop help`. - In workshops 1 and 2 the chatbot has no slash commands: they answer "Unknown command". From workshop 3, `/context` shows what fills the window and `/status` shows the key in use; from workshop 4, `/mcp` shows the tools. - To leave a conversation in any mode, press Ctrl+C twice, and to read an open `.md` file as a page, press Ctrl+Shift+V (Cmd+Shift+V on a Mac); in the terminal, copy and paste are Ctrl+Shift+C / Ctrl+Shift+V (Cmd+C / Cmd+V on a Mac). - If something breaks, ask me: your files stay in the Codespace.

Repères de SETUP.md (copié dans chaque dépôt d'atelier). Vérifié à la répétition : en bare, A et B (--disable-slash-commands), /exit répond « Unknown command » ; Ctrl+C deux fois quitte dans tous les modes. /context, /mcp, /status : à partir de C.