Make the toolSearch result limit configurable
Background
toolSearch currently returns at most five deferred tools. For workflows that commonly require several related actions, this fixed breadth can omit a needed tool and force the model to perform another search and model round trip.
Feature Request
Allow toolSearch to accept an optional options object containing maxResults?: number while keeping zero-argument toolSearch() valid. Default maxResults to 5 so existing callers retain their current behavior. Apply the limit at the final ranked-result selection stage, including when results originate from a custom ranking implementation, so no more than maxResults tools are accepted. Update the model-facing tool description to state the configured limit rather than always saying that up to five matching tools are returned.
Related Issues
Extracted from #21861
Source: vercel/ai