The Model Interaction Flow
A tool call is not one message on the wire. It is a loop the host runs between a user, a model, and a server, and every turn of that loop decides what the model gets to see next. Trace the full path from a user request through a host built model context, a tool selection, a confirmation gate, a tools/call, server execution, and the result returning to the model. State exactly what the model sees at each turn: tool names, descriptions, and schemas before a call, and content or an isError flag after one. Apply a confirmation gate that shows a tool's drafted inputs to a human before a destructive call ever reaches the wire, using the annotation defaults from the manifest reading lesson. Explain why deterministic tool ordering protects both a client's own cache and the model provider's prompt cache. Tell an inputrequired interruption, a tool execution error, and a protocol error apart by how each one changes what the loop does next. The last few lessons covered the documents a server hands a client: a discover result, a tool list, a manifest worth reading with suspicion. None of that explains what actually happens the moment a person types a request. A tool definition sitting in tools/list is inert until something turns it into a decision, a wire…
The Model Interaction Flow: A tool call is not one message on the wire. It is a loop the host runs between a user, a model, and a server, and every turn of…
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.