Opening images with read_file

Overview

read_file opens a picture instead of reading it as text. When the path ends in a picture extension, the tool attaches the file's pixels to the tool result as an image, so a vision model actually sees the screenshot, diagram, or photo — and the chat card paints the same picture back to the user. Text files keep their existing behavior; .svg stays on the text path because its markup is what a model can use.

Usage

Ask the assistant to look at an image, or call the tool directly:

read_file { "path": "docs/features/images/inspector-panel.png" }

Supported extensions: .png, .jpg, .jpeg, .gif, .webp, .bmp, .ico. .svg is read as text (markup).

startLine / endLine do not apply to a picture and are ignored.

Finding an image

list_files lists pictures alongside text files and marks them, so the model can find one without a shell round trip:

# Listing: <all text and image files>
# Count: 2

# docs/features/images/
  inspector-panel.png (image)
  notes.md

The model-facing result

An image read returns a three-line header — no base64 payload — plus the picture itself, which arrives as a separate vision message part right after the tool result:

# File: docs/features/images/inspector-panel.png
# Kind: image (image/png, 184320 bytes)
# The picture is attached to this tool result as an image part.

The chat card

The tool card shows the path, the MIME type, the size, and the picture. Tap the thumbnail to open it full screen; tap outside the picture, tap ✕, or press Escape to close. A result that reached the UI as plain text (a replayed transcript row, a nested subagent result) has no bytes left, so the card says Image bytes are not part of this result. instead of painting an empty frame.

Behavior

{
  "fileReadMaxLines": 10000,
  "fileReadMaxImageBytes": 4194304
}