Back to feed
Dev.to
Dev.to
7/20/2026
OpenCode Tool Calling Internals

OpenCode Tool Calling Internals

Short summary

A deep technical analysis of OpenCode's tool-calling implementation, framed for developers building agent runtimes. It argues tool calling must be treated as a runtime subsystem—not a provider feature—covering internal tool contracts, dynamic catalogs, permission gates, state persistence, event normalization, and debuggability. The piece draws concrete lessons from OpenCode's codebase including registry, session adapter, and LLM runtime adapter layers.

  • Tool calling should be a runtime subsystem with internal contracts, not just provider callbacks
  • Permission gates must block at execution point, not rely on prompt instructions or UI
  • Persist tool calls as state with identity, progress, output, and cancellation behavior

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more