CourseModel Context Protocol: The Complete Course · Module 3: Tools · part 25 of 77
Part 25 · Module 3: Tools

Lab: Give the notes server its tool contract

37 min read·13 Oct 2026
Module 3 · Lab · About 60 minutes · Needs: lessons 1 to 4 of this module, the Module 1 lab, and a free Groq or Gemini key for the last cell of Step 7 (course-guide/02)

What you are building

MYDRIVE/NOTES-ASSISTANT AFTER MODULE 3 m03_server.py 2 tools, final design store.py Module 1, unchanged notes/ 8 notes test_m03_tools 7 contract tests m03_lab.py tool choice, 20 Qs your model or the stand-in earlier modules' files rebuilt only if missing
The lab adds three files: the server (blue), the contract tests that guard it (green), and a script that measures tool choice with your model (amber) or a stand-in.

It is Monday 14 September 2026, the start of week 2. In four lessons you designed search_notes and create_note properly: names that survive a host's prefix, honest annotations, bounded arguments, structured results, errors the model can read, and a tool list small enough to send on every call. All of it lives in lesson folders. This lab moves Lesson 1's server into the repository as examples/m03_server.py, writes the tool contract, a test file that fails the moment any of those promises breaks, and adds examples/m03_lab.py, which measures which tool gets chosen for course-guide/06's 20 labelled questions. You finish by committing all three files.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.