promptdojo_
Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Final drill. You're prototyping an MCP server before wrapping it in JSON-RPC stdio — this is the dispatch shape you'll port.

Build the whole tiny server. Two functions:

  • list_tools(registry) — returns a list of {"name": ..., "description": ...} dicts (one per tool), in registry insertion order. No handlers in the output.
  • call_tool(name, args, registry) — the dispatcher from the previous step. Unknown tool → error envelope with unknown tool: <name>. Missing required arg → error envelope with missing required arg: <key>. Success → wrap handler return value in the success envelope.

Then exercise it: list tools, call each with valid args, and call with an unregistered name.

Expected output:

[{'name': 'add', 'description': 'Add two numbers.'}, {'name': 'shout', 'description': 'Uppercase a string.'}]
5
HELLO
unknown tool: ghost

this step needs the editor

on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.

open this same url on a laptop to keep going today.