---
title: "init(tool:underlyingError:)"
framework: foundationmodels
role: symbol
role_heading: Initializer
path: "foundationmodels/languagemodelsession/toolcallerror/init(tool:underlyingerror:)"
---

# init(tool:underlyingError:)

Creates a tool call error

## Declaration

```swift
init(tool: any Tool, underlyingError: any Error)
```

## Parameters

- `tool`: The tool that produced the error.
- `underlyingError`: The underlying error that was thrown during a tool call.
