Skip to content

Conversation

@yuguorui
Copy link
Contributor

What does this PR do?

Introduce Programmatic Tool Calling (PTC) support for plugins, enabling plugins to invoke tools directly within a session without relying on LLM vendor-specific APIs.

This change exposes a unified tool invocation API that:

  • Allows plugins to execute tools programmatically
  • Reduces LLM round-trips and token consumption
  • Decouples plugin PTC implementation from underlying model providers (e.g. Anthropic-specific APIs)

To support this, the JS SDK (v1/v2) is regenerated to expose the new execute API and related types, allowing plugin authors to implement PTC in a provider-agnostic way.

Without this change, plugins in opencode can only achieve PTC via vendor-dependent LLM APIs and cannot invoke tools directly.


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

Closes #4713

How did you verify your code works?

I've written a POC plugin to wrap the tools into async javascript functions, and the model is able to create 10k TODOs or 10 subtasks concurrently 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.

534655848-49e67f16-bcfb-48a0-813b-37eaa09e9795

Introduce Programmatic Tool Calling (PTC) support for plugins, enabling plugins
to invoke tools directly within a session without relying on LLM vendor-specific
APIs.

This change exposes a unified tool invocation API that:
- Allows plugins to execute tools programmatically
- Reduces LLM round-trips and token consumption
- Decouples plugin PTC implementation from underlying model providers (e.g.
  Anthropic-specific APIs)

To support this, the JS SDK (v1/v2) is regenerated to expose the new `execute`
API and related types, allowing plugin authors to implement PTC in a
provider-agnostic way.

Without this change, plugins in opencode can only achieve PTC via
vendor-dependent LLM APIs and cannot invoke tools directly.

Signed-off-by: yuguorui <[email protected]>
---
[1] https://platform.claude.com/cookbook/tool-use-programmatic-tool-calling-ptc
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Claude Advanced Tool Usage

1 participant