# IFoundryTool Methods

- Package: [Aspire.Hosting.Foundry](/reference/api/csharp/aspire.hosting.foundry.md)
- Type: [IFoundryTool](/reference/api/csharp/aspire.hosting.foundry/ifoundrytool.md)
- Kind: `Methods`
- Members: `1`

Represents a Foundry tool that can be attached to a prompt agent.

## ToAgentToolAsync(CancellationToken)

- Name: `ToAgentToolAsync(CancellationToken)`
- Modifiers: `abstract`
- Returns: `Task<ResponseTool>`

Converts this tool definition into the SDK `Responses.ResponseTool` representation.

```csharp
public interface IFoundryTool
{
    public abstract Task<ResponseTool> ToAgentToolAsync(
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `cancellationToken` (`CancellationToken`) `optional`
  A cancellation token.

## Returns

`Task<ResponseTool>` -- The SDK tool representation.

## Remarks

This method is called at deploy time, after infrastructure provisioning is complete. Tools that depend on provisioned resources (e.g., Azure AI Search connections) can safely resolve their connection identifiers at this point.
