---
title: File
description: Read, fetch, write, and append files
---

import { BlockInfoCard } from "@/components/ui/block-info-card"

<BlockInfoCard 
  type="file_v4"
  color="#40916C"
/>

{/* MANUAL-CONTENT-START:intro */}
The File Parser tool provides a powerful way to extract and process content from various file formats, making it easy to incorporate document data into your agent workflows. This tool supports multiple file formats and can handle files up to 200MB in size.

With the File Parser, you can:

- **Process multiple file formats**: Extract text from PDFs, CSVs, Word documents (DOCX), text files, and more
- **Handle large files**: Process documents up to 200MB in size
- **Parse files from URLs**: Directly extract content from files hosted online by providing their URLs
- **Process multiple files at once**: Upload and parse several files in a single operation
- **Extract structured data**: Maintain formatting and structure from the original documents when possible

The File Parser tool is particularly useful for scenarios where your agents need to work with document content, such as analyzing reports, extracting data from spreadsheets, or processing text from various document sources. It simplifies the process of making document content available to your agents, allowing them to work with information stored in files just as easily as with direct text input.
{/* MANUAL-CONTENT-END */}


## Usage Instructions

Read workspace files by picker or canonical ID, fetch and parse files from URLs with optional headers, write new workspace files, or append content to existing files.



## Tools

### `file_fetch`

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `file` | file | First workspace file object \(read\) |
| `files` | file[] | Workspace file objects \(read\) or fetched file objects \(fetch\) |
| `combinedContent` | string | All fetched file contents merged into a single text string \(fetch\) |
| `id` | string | File ID \(write\) |
| `name` | string | File name \(write\) |
| `size` | number | File size in bytes \(write\) |
| `url` | string | URL to access the file \(write\) |

### `file_read`

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `file` | file | First workspace file object \(read\) |
| `files` | file[] | Workspace file objects \(read\) or fetched file objects \(fetch\) |
| `combinedContent` | string | All fetched file contents merged into a single text string \(fetch\) |
| `id` | string | File ID \(write\) |
| `name` | string | File name \(write\) |
| `size` | number | File size in bytes \(write\) |
| `url` | string | URL to access the file \(write\) |

### `file_write`

Create a new workspace file. If a file with the same name already exists, a numeric suffix is added (e.g., 

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `fileName` | string | Yes | File name \(e.g., "data.csv"\). If a file with this name exists, a numeric suffix is added automatically. |
| `content` | string | Yes | The text content to write to the file. |
| `contentType` | string | No | MIME type for new files \(e.g., "text/plain"\). Auto-detected from file extension if omitted. |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `id` | string | File ID |
| `name` | string | File name |
| `size` | number | File size in bytes |
| `url` | string | URL to access the file |

### `file_append`

Append content to an existing workspace file. The file must already exist. Content is added to the end of the file.

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `fileName` | string | Yes | Name of an existing workspace file to append to. |
| `content` | string | Yes | The text content to append to the file. |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `id` | string | File ID |
| `name` | string | File name |
| `size` | number | File size in bytes |
| `url` | string | URL to access the file |


