How can I set "count" parameter for Grounding with Bing Search

Tam Thai Hoang Minh 20 Reputation points
2025-06-04T11:21:34.1133333+00:00

Hi team,

I am writing regarding an issue with the Bing Grounding tool in Azure AI Agents. Despite reviewing the documentation thoroughly, I have been unable to find clear instructions on how to increase the number of search results returned by the Bing search tool.

Issue Details:

  • The default of 5 search results is insufficient for my use case
  • I need to increase this to 15 results for better grounding capability
  • My agent frequently responds with "sorry I could not find the information" due to limited search results

Documentation Referenced:

I have carefully reviewed the documentation at https://learn.microsoft.com/en-us/azure/ai-services/agents/how-to/tools/bing-grounding and only found one C# example that hints at configuration options, but no clear TypeScript/JavaScript examples or parameter documentation.

In the Azure AI Studio UI, I don't see any option to configure this parameter either 🥲

Questions:

  1. Is it possible to configure the "count" parameter for Bing search results in Azure AI Agents?
  2. If no, what is the correct approach using the TypeScript/JavaScript SDK to increase the count of Bing Search?

Thank you for your assistance.

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,579 questions
0 comments No comments
{count} votes

Accepted answer
  1. JAYA SHANKAR G S 3,880 Reputation points Microsoft External Staff Moderator
    2025-06-06T09:01:48.3566667+00:00

    Hello @Tam Thai Hoang Minh ,

    Yes, you can use count parameter for number search results.

    You can refer this documentation for more about parameters.

    Below is the code to initialize bing search tool.

    const bingTool = ToolUtility.createBingGroundingTool([{ connectionId: connectionId ,count: 15}]);
    

    Here, for bing search tool you need to pass list of dictionary type configuration with connection id and count.

    After you creating the run you can verify it with below code.

      const runSteps = await client.runSteps.list(thread.id, run.id);
    
      for await (const step of runSteps) {
        console.log(`Step ${step.id} status: ${step.status}`);
    
        const stepDetails = step.stepDetails ?? {};
        const toolCalls = stepDetails.toolCalls ?? [];
        console.log(toolCalls);
    
      }
    

    Output:

    enter image description here

    Try it and let us know if you have any query.

    If above answer helped you do accept it and give feedback by clicking on yes.

    Thank you


1 additional answer

Sort by: Most helpful
  1. Suwarna S Kale 3,311 Reputation points
    2025-06-05T02:11:54.38+00:00

    Hello Tam Thai Hoang Minh,

    Thank you for posting your question in the Microsoft Q&A forum. 

    The Bing Grounding tool in Azure AI Agents currently presents a limitation where only five search results are returned by default, which can negatively impact the agent's ability to provide comprehensive responses. While this restriction isn't configurable through the Azure AI Studio interface, developers can programmatically adjust the result count using the TypeScript/JavaScript SDK. 

    To increase the number of search results, you must explicitly configure the Bing Grounding tool during initialization or query execution. The solution involves setting either the count or maxResults parameter to your desired value (e.g., 15) when instantiating the tool or when making API calls. This approach provides greater control over search result retrieval, though developers should be mindful of potential trade-offs, including increased latency and higher API consumption. 

    Key considerations when implementing this solution include: 

    • API Limits: Verify that your Bing Search API tier supports the requested number of results 
    • Error Handling: Implement robust fallback mechanisms for cases where fewer results are returned 
    • Performance Optimization: Consider caching strategies to minimize repeated API calls 

    Microsoft's documentation currently lacks explicit guidance on this parameter for TypeScript/JavaScript implementations, but the programmatic approach outlined here effectively addresses the limitation while maintaining compatibility with Azure AI Agents' architecture. As the platform evolves, additional configuration options may become available through the UI, but for now, SDK-based configuration remains the most reliable method for customizing search result volume. 

    If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue. Your contribution to the Microsoft Q&A community is highly appreciated. 

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.