Phase 19: Capstone Projects

Tool Registry with Schema Validation

A tool the agent cannot validate is a tool the agent cannot call. Build the registry and the schema checker before you build the tools. Hold a typed registry of tool name → schema → handler that the dispatcher can ask once and trust afterwards. Implement a JSON Schema 2020-12 subset that covers the keywords ninety percent of tool calls actually use. Return precise, json-pointer-shaped error paths so the model can self-correct in one round trip. Reject re-registration without explicit override, since silent overwrites are how production tool catalogs drift. Keep the validator pure (no I/O, no time, no globals) so it can be re-run on a replay log. A coding agent in 2026 has more registered tools than the model can fit in a single context window. A non-trivial harness will register two hundred tools and surface ten to forty at any given turn. The registry is the source of truth for "what tools exist," "what shape do their arguments take," and "what handler do I call." Once those three answers are pinned, the rest of the harness can stop guessing. The mistake we are avoiding is shipping handlers without schemas, or shipping schemas without validation. Both are common. Both turn the next layer (the dispatcher in lesson twenty-three) into a guessing game where the only failure mode is…

Tool Registry with Schema Validation: A tool the agent cannot validate is a tool the agent cannot call. Build the registry and the schema checker before you…

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.