[PR #8022] feat: plugin: add plugin interfaces for Programmatic Tool Calling (PTC) #12594

Closed
opened 2026-02-16 18:17:29 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8022

State: closed
Merged: No


What does this PR do?

Programmatic Tool Calling (PTC)[1] lets code invoke tools directly in the execution environment, cutting model round-trips, latency, and tokens. Without an execution API, models could not programmatically invoke tools and had to fall back to provider-native tool calling, which blocks PTC on other models.

Introduce a tool execution API to run a tool by id with session/message context, provider/agent filtering, and permission gating, returning title/output/metadata.

Regenerate the JS SDK (v1/v2) to expose the new execute API and types so plugins can implement PTC regardless of the underlying model provider.

[1] https://platform.claude.com/cookbook/tool-use-programmatic-tool-calling-ptc

Closes #4713

How did you verify your code works?

I've writing a POC plugin to wrap the tools into async javascript functions, and the model is able to create 10k TODOs with the new interface.

Because it currently depends on a local SDK version, it has not been released yet. I will complete it as soon as possible and open-source it under the MIT license.

image
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8022 **State:** closed **Merged:** No --- ### What does this PR do? Programmatic Tool Calling (PTC)[1] lets code invoke tools directly in the execution environment, cutting model round-trips, latency, and tokens. Without an execution API, models could not programmatically invoke tools and had to fall back to provider-native tool calling, which blocks PTC on other models. Introduce a tool execution API to run a tool by id with session/message context, provider/agent filtering, and permission gating, returning title/output/metadata. Regenerate the JS SDK (v1/v2) to expose the new execute API and types so plugins can implement PTC regardless of the underlying model provider. [1] https://platform.claude.com/cookbook/tool-use-programmatic-tool-calling-ptc Closes #4713 ### How did you verify your code works? I've writing a POC plugin to wrap the tools into async javascript functions, and the model is able to create 10k TODOs with the new interface. Because it currently depends on a local SDK version, it has not been released yet. I will complete it as soon as possible and open-source it under the MIT license. <img width="3170" height="1742" alt="image" src="https://github.com/user-attachments/assets/49e67f16-bcfb-48a0-813b-37eaa09e9795" />
yindo added the pull-request label 2026-02-16 18:17:29 -05:00
yindo closed this issue 2026-02-16 18:17:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12594