<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/SpotlightSearchTool/FormatLevel",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Core Spotlight",
      "FoundationModels",
      "_CoreSpotlight_FoundationModels"
    ],
    "preciseIdentifier" : "s:31_CoreSpotlight_FoundationModels0B10SearchToolV11FormatLevelO"
  },
  "title" : "SpotlightSearchTool.FormatLevel"
}
-->

# SpotlightSearchTool.FormatLevel

Controls how tool responses are serialized for the model’s context window.

```
enum FormatLevel
```

## Overview

The tool returns search results to the model as part of the generation context.
The format level determines how those results are encoded:

- `.structured`: Full encoding with the highest fidelity,
  highest token cost. Best when the model needs to reason over attribute
  keys and values precisely (e.g., filtering, re-querying).
- `.compact`: Terse, line-oriented text encoding. Best for models with
  limited context.

## Topics

### Getting the format levels

[`case compact`](/documentation/CoreSpotlight/SpotlightSearchTool/FormatLevel/compact)

Compact encoding

[`case structured`](/documentation/CoreSpotlight/SpotlightSearchTool/FormatLevel/structured)

Full, structured encoded

## Relationships

### Conforms To

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

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

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

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

---

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)