Skip to content

Conversation

@eXamadeus
Copy link

@eXamadeus eXamadeus commented Jan 17, 2026

What does this PR do?

Fixes: #8327

Related: #8269, #8380

Note

This is complementary to the v2 SDK upgrade in #8380. This PR improves type safety of the ToolContext used for developing custom tools in plugins. The other PR is focused on upgrading the client capabilities for plugins. Similar, but slightly different goals.

This PR aligns plugin tool types with the capabilities tools already have. Specifically:

  • Exposes ToolContext fields to plugin tools: callID, extra, metadata(), and ask() to give plugins the correct context types
  • Adds ExecuteResult type allowing plugin tools to return structured result objects with title, metadata, output, and attachments instead of only plain strings
  • Updates the registry to handle structured results from plugin tools, bypassing truncation when plugins return an ExecuteResult directly (assuming tools till truncate...we could add a check here?)
  • Exports all useful intermediate-types so plugin authors can use them more ergonomically.

This enables plugins to provide richer tool responses with proper metadata updates, closer matching the flexibility of built-in tools.

How did you verify your code works?

  • Added tests to ensure both string returns and object returns work as expected
  • Ran TypeScript type checking
  • Verified locally with a plugin in development that required proper metadata updates from plugin tools

The types all align nicely in the registry:

type changes

Note

Replaces #8328 because I needed to use the dev branch in my cloned repo for other things...GitHub wouldn't let me update the branch the PR originated from so I had to make a new one.

Fix plugin tool types to expose ToolContext fields and ExecuteResult
that built-in tools already have access to. The only functional change
is allowing plugin tools to return structured result objects (with title,
metadata, attachments) instead of only plain strings.
@github-actions
Copy link
Contributor

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

Potential Duplicate Found

PR #8328: feat(plugin): align plugin tool types with built-in tool capabilities
#8328

Why they're related:
This is the PR that the current PR (#9138) explicitly replaces. According to the PR description, #9138 was created because the dev branch couldn't be updated on the original #8328 PR, so a new one was opened instead. These are effectively the same feature implementation, with #9138 being the newer version on the dev branch that supersedes #8328.

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]: Plugin package tool types should stay aligned

1 participant