# BingGroundingToolResource

- Kind: `class`
- Package: [Aspire.Hosting.Foundry](/reference/api/csharp/aspire.hosting.foundry.md)
- Version: `13.4.0-preview.1.26281.18`
- Namespace: `Aspire.Hosting.Foundry`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Foundry/ToolResources/BingGroundingToolResource.cs)
- Inherits: [FoundryToolResource](/reference/api/csharp/aspire.hosting.foundry/foundrytoolresource.md)

A Foundry tool resource that grounds an agent's responses using Bing Search.

## Definition

```csharp
namespace Aspire.Hosting.Foundry;

public class BingGroundingToolResource
    : Aspire.Hosting.Foundry.FoundryToolResource
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Foundry/BingGroundingToolResource`

## Remarks

The Bing Search resource ( `Microsoft.Bing/accounts`) must be created manually in the [Azure portal](https://portal.azure.com) before using this tool.

After creating the tool with [PromptAgentBuilderExtensions.AddBingGroundingTool(IResourceBuilder<AzureCognitiveServicesProjectResource>, string)](/reference/api/csharp/aspire.hosting.foundry/promptagentbuilderextensions/methods.md#addbinggroundingtool-iresourcebuilder-azurecognitiveservicesprojectresource-string), link it using one of the `WithReference` overloads on [PromptAgentBuilderExtensions](/reference/api/csharp/aspire.hosting.foundry/promptagentbuilderextensions.md) with one of the following:

- A [BingGroundingConnectionResource](/reference/api/csharp/aspire.hosting.foundry/binggroundingconnectionresource.md) created by [AzureCognitiveServicesProjectConnectionsBuilderExtensions.AddBingGroundingConnection(IResourceBuilder<AzureCognitiveServicesProjectResource>, string, string)](/reference/api/csharp/aspire.hosting.foundry/azurecognitiveservicesprojectconnectionsbuilderextensions/methods.md#addbinggroundingconnection-iresourcebuilder-azurecognitiveservicesprojectresource-string-string).
- A Bing resource ID string to auto-create a connection.
- A `ApplicationModel.IResourceBuilder`1` for `ApplicationModel.ParameterResource` containing the Bing resource ID.

## Constructors

- [BingGroundingToolResource(string, AzureCognitiveServicesProjectResource)](/reference/api/csharp/aspire.hosting.foundry/binggroundingtoolresource/constructors.md#constructor-string-azurecognitiveservicesprojectresource) -- Creates a new instance of the [BingGroundingToolResource](/reference/api/csharp/aspire.hosting.foundry/binggroundingtoolresource.md) class.

## Methods

- [ToAgentToolAsync(CancellationToken)](/reference/api/csharp/aspire.hosting.foundry/binggroundingtoolresource/methods.md#toagenttoolasync-cancellationtoken) : `Task<ResponseTool>` -- Converts this tool definition into the SDK `Responses.ResponseTool` representation.
