---
title: ToolExpectation
framework: evaluations
role: symbol
role_heading: Structure
path: evaluations/toolexpectation
---

# ToolExpectation

A specification for an expected tool call, or a group of expectations that can be satisfied in any order.

## Declaration

```swift
struct ToolExpectation
```

## Mentioned in

Evaluating language model responses Evaluating tool-calling behavior

## Overview

Overview Most commonly, a ToolExpectation identifies a single tool by name and optionally validates its arguments: ToolExpectation("getWeather", arguments: [     .exact(argumentName: "location", value: "Paris, France") ]) For ordered sequences where multiple tools must all be called at the same position but their relative order doesn’t matter, use anyOrder(_:): ToolExpectation.anyOrder([     ToolExpectation("fetchData"),     ToolExpectation("fetchMetadata"), ])

## Topics

### Creating an expectation

- [init(_:arguments:)](evaluations/toolexpectation/init(_:arguments:).md)

### Creating any-order groups

- [anyOrder(_:)](evaluations/toolexpectation/anyorder(_:).md)

### Accessing expectation details

- [name](evaluations/toolexpectation/name.md)
- [arguments](evaluations/toolexpectation/arguments.md)
- [isAnyOrderGroup](evaluations/toolexpectation/isanyordergroup.md)

### Matching arguments

- [ArgumentMatcher](evaluations/argumentmatcher.md)

## Relationships

### Conforms To

- [ConvertibleFromGeneratedContent](foundationmodels/convertiblefromgeneratedcontent.md)
- [ConvertibleToGeneratedContent](foundationmodels/convertibletogeneratedcontent.md)
- [Copyable](swift/copyable.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Escapable](swift/escapable.md)
- [Generable](foundationmodels/generable.md)
- [InstructionsRepresentable](foundationmodels/instructionsrepresentable.md)
- [PromptRepresentable](foundationmodels/promptrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Creating a single-tool expectation

- [init(expected:arguments:)](evaluations/trajectoryexpectation/init(expected:arguments:).md)
