Thuta Learning
ProjectsAIbeginner

Connect One Safe Tool First

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand how to connect a safe tool first — no need to be intimidated by it
  • Get hands-on practice testing it yourself
  • Learn to sidestep permission issues, secrets, and guesswork without breaking a sweat

Your first working agent only needs to call one tool. Start with a read-only tool like list_notes.

Let's think about this for a second

Connecting a tool means telling the model "call it like this," then you run the function yourself and feed the result text back in. This first step doesn't need a pile of APIs. All you need is one function that returns a list of filenames, and one loop iteration. Get that working before adding a read tool. Don't try to add search, read, write, and send all at once.

Let's connect this to everyday life

Set up a fake notes folder: photosynthesis.md, algebra.md, history.md. Have list_notes() return just those three names. Ask the agent, "What notes do I have?" The correct answer names exactly those three files — the model shouldn't invent extra ones. Don't move on until this test passes. Even without Node.js set up yet, you can do this on paper: write out "tool result = …" and "model reply = …" by hand.

Let's try it out together

javascript
const NOTES = ["photosynthesis.md", "algebra.md", "history.md"];

function listNotes() {
  return { files: NOTES };
}

// Agent sees only this result, then answers the user.
console.log(listNotes());
You should see
You'll connect a read-only tool to the agent loop and get it to show an accurate list.

5-minute try

Write out the list_notes result for a fake folder yourself. Then compare what the agent should say versus a wrong answer when asked "what files exist?"

A quick word of caution

Don't let your first tool see the entire disk. Restrict it to a single lesson folder.

Easy traps

  • Polishing the UI before connecting any tool
  • Letting the model get away with inventing a file that doesn't exist

Now try it yourself

Write out the list_notes result for a fake folder yourself. Then compare what the agent should say versus a wrong answer when asked "what files exist?"

You'll know it worked when: You'll connect a read-only tool to the agent loop and get it to show an accurate list.

Connect One Safe Tool First | Thuta Learning