ai@7.0.127: Improved Tool Search Ranking and Configurable Results
The latest update to ai adds improved tool search functionality with selection/ranking of deferred tools, a configurable result limit, and better cross-realm compatibility for tool approval.
What changed?
ai@7.0.127 introduces several enhancements focused on tool search functionality and cross-realm compatibility. Notably, the 'search()' callback used for tool search now supports selection and ranking of eligible deferred tools. Developers can also control the maximum number of tools returned using a new maxResults configuration option. Additionally, tool approval inputs are now recognized as unchanged even when they originate from different JavaScript execution contexts.
Why does it matter to an everyday developer?
These updates provide finer control over tool discoverability and workflow efficiency. The improved ranking via the 'search()' callback means more relevant results when searching for tools, especially for complex integrations relying on deferred tool availability. The maxResults configuration prevents unnecessary clutter by allowing developers to limit search responses to a defined number. Lastly, improved handling of approval inputs across JavaScript realms helps avoid interoperability issues in larger or modular frontend applications.
What can the developer do now?
Developers should review their use of the tool search API. They can now implement or refine custom ranking/selection logic for deferred tools using the updated 'search()' callback, and set the maxResults option to tailor search outputs for their UI needs. For projects with complex frontends or microfrontend patterns, updates to cross-realm tool approvals may simplify integration and reduce bugs.
