---
title: OCRTool
framework: vision
role: symbol
role_heading: Structure
path: vision/ocrtool
---

# OCRTool

A tool that recognizes text in an image.

## Declaration

```swift
struct OCRTool
```

## Overview

Overview The tool returns a string containing all recognized text from the image. To enable this tool, configure your LanguageModelSession with an instance of OCRTool. let ocrTool = OCRTool() let session = LanguageModelSession(tools: [ocrTool]) You can override the default name and description to customize how the model identifies and uses the tool. let customTool = OCRTool(     name: "extractText",     description: "Extract text from documents" )

## Topics

### Initializers

- [init(name:description:)](vision/ocrtool/init(name:description:).md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Tool](foundationmodels/tool.md)
