CourseModel Context Protocol: The Complete Course · Module 5: Building Servers · part 37 of 77
Part 37 · Module 5: Building Servers

Lesson 3: Long-running handlers that report progress and stop

26 min read·13 Oct 2026
Module 5 · Lesson 3 · About 60 minutes · Needs: Lesson 1 of this module (the packaged server); Module 2 Lesson 2 (progress and cancellation on the wire); no model key

The situation

Monday 21 September 2026. Tomas wants a "reindex" button that rebuilds the assistant's word index after he adds notes. On a full archive that takes minutes, so he asks for three things: Nare can still search while it runs, he can see how far it has got, and Stop stops it without leaving a half-written index.

Module 2 showed progress and cancellation on the wire. This lesson is the handler's side. You follow one call, reindex_notes over four of Nare's notes, as it runs, reports, stops and is tested.

MONDAY 21 SEPTEMBER: THE REINDEX BUTTON reindex_notes 4 notes, slow Nare searches still answered Tomas watches progress 2/4 Tomas presses Stop old index kept
Tomas's reindex button makes three demands of one handler (blue, the normal path): keep other calls answered, show progress, and stop cleanly (green) when asked.

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.