This document analyzes OpenCode's tool-calling implementation from the perspective of someone building an agent runtime. The goal is not only to explain how OpenCode happens to call tools today. The more useful question is: what design problems does a real coding-agent runtime have to solve once tool calling moves beyond a demo callback?

Primary code references:

packages/opencode/src/tool/tool.ts

packages/opencode/src/tool/registry.ts

packages/opencode/src/session/tools.ts