# AzurePromptAgentResource.WithTool

- Module: [Aspire.Hosting.Foundry](/reference/api/go/aspire.hosting.foundry.md)
- Defined on: [AzurePromptAgentResource](/reference/api/go/aspire.hosting.foundry/azurepromptagentresource.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`

Adds a tool to a prompt agent.

## Definition

```go
type AzurePromptAgentResource interface {
    // ... omitted for brevity
    WithTool(tool FoundryToolResource) AzurePromptAgentResource
}
```

## Signature

```go
WithTool(tool FoundryToolResource) AzurePromptAgentResource
```

## Parameters

- `tool` ([`FoundryToolResource`](/reference/api/go/aspire.hosting.foundry/foundrytoolresource.md)) -- The tool resource to attach to this agent.

## Returns

[`AzurePromptAgentResource`](/reference/api/go/aspire.hosting.foundry/azurepromptagentresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [AzurePromptAgentResource](/reference/api/go/aspire.hosting.foundry/azurepromptagentresource.md) -- `handle`
