<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/LanguageModelSession/ToolCallError",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation Models",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:16FoundationModels20LanguageModelSessionC13ToolCallErrorV"
  },
  "title" : "LanguageModelSession.ToolCallError"
}
-->

# LanguageModelSession.ToolCallError

An error that occurs while a language model is calling a tool.

```
struct ToolCallError
```

## Topics

### Creating a tool call error

[`init(tool:underlyingError:)`](/documentation/FoundationModels/LanguageModelSession/ToolCallError/init(tool:underlyingError:))

Creates a tool call error

### Getting the tool

[`tool`](/documentation/FoundationModels/LanguageModelSession/ToolCallError/tool)

The tool that produced the error.

### Getting the error description

[`errorDescription`](/documentation/FoundationModels/LanguageModelSession/ToolCallError/errorDescription)

A string representation of the error description.

### Getting the underlying error

[`underlyingError`](/documentation/FoundationModels/LanguageModelSession/ToolCallError/underlyingError)

The underlying error that was thrown during a tool call.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`LocalizedError`](/documentation/Foundation/LocalizedError)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Error`](/documentation/Swift/Error)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)