Read file
read_fileRead a file's contents as raw base64 bytes or UTF-8 text, up to 4 MiB per call, and page through larger files using a byte offset.
Instructions
Read one file's contents as base64 bytes or UTF-8 text, at most 4 MiB per call. Use when: you need a file's contents; page through a larger one with offset. Instead: search_content to find lines across files; read_file_version for an older version; render_preview for an image. Behavior: read-only. Refuses secret files. A folder or missing file fails; text never cuts a character in two. Time limit: 15 s. Returns: {content_b64 or text, size (bytes in this page; get_path_info gives the file's), truncated, replaced (text: bad bytes became U+FFFD)}. When truncated, or when offset was given, also offset and next_offset. An offset past the end returns empty content with truncated false.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "read_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | The file to read (absolute, or relative to the MCP root). Required unless path_b64 is given. | |
| offset | No | Byte offset to start at; pass the previous call's next_offset to continue. | |
| backend | No | Backend id from list_backends; omit for the default. | |
| encoding | No | base64 (default): the exact bytes, safe for any file. text: decoded as UTF-8 - pass it for text files. | base64 |
| path_b64 | No | path as base64 of its raw bytes, for non-UTF-8 names; replaces path. | |
| max_bytes | No | Most bytes to return; 0 or omitted means the ceiling, 4194304 (4 MiB). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | Yes | bytes read | |
| text | No | the text (encoding=text) | |
| offset | No | ||
| replaced | No | text: undecodable bytes replaced | |
| truncated | Yes | ||
| content_b64 | No | the bytes (encoding=base64) | |
| next_offset | No |