# withMcpTool

- Module: [Aspire.Hosting.Foundry](/reference/api/typescript/aspire.hosting.foundry.md)
- Version: `13.6.0-preview.1.26478.8`
- Kind: `method`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62)

Adds an MCP tool definition to the Toolbox.

## Definition

```typescript
interface FoundryToolboxResource {
  // ... omitted for brevity
  withMcpTool(
    name: string,
    endpoint: string | EndpointReference | ReferenceExpression,
    options?: FoundryToolboxMcpToolOptions): FoundryToolboxResource
}
```

## Parameters

- `name` (`string`)
- `endpoint` (`string | EndpointReference | ReferenceExpression`)
- `options` ([FoundryToolboxMcpToolOptions](/reference/api/typescript/aspire.hosting.foundry/foundrytoolboxmcptooloptions.md)) `optional`

## Returns

[FoundryToolboxResource](/reference/api/typescript/aspire.hosting.foundry/foundrytoolboxresource.md) `builder`

## Applies to

- [FoundryToolboxResource](/reference/api/typescript/aspire.hosting.foundry/foundrytoolboxresource.md)
