feat(plugin): align plugin tool types with built-in tool capabilities #8328
+27
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ToolContextused 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:
ToolContextfields to plugin tools:callID,extra,, andmetadata()to give plugins the correct context typesask()metadata()andask()were added in fix: add missing metadata() and ask() defintions to ToolContext type #8269ExecuteResulttype allowing plugin tools to return structured result objects withtitle,metadata,output, andattachmentsinstead of only plain stringsExecuteResultdirectly (assuming tools till truncate...we could add a check here?)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?
The types all align nicely in the registry: