## Tool: `read_file_content`

> [!WARNING]
> **Developer Preview:** Available as part of the [Google Workspace Developer Preview Program](https://developers.google.com/workspace/preview), which grants early access to certain features.

Call this tool to fetch a natural language representation of a Drive file, and optionally, its comments.

The file content may be incomplete for very large files. The text representation will change over time, so don't make assumptions about the particular format of the text returned by this tool. If supported, comment tags will be included in the content.

Supported Mime Types:

- `application/vnd.google-apps.document`
- `application/vnd.google-apps.presentation`
- `application/vnd.google-apps.spreadsheet`
- `application/pdf`
- `application/msword`
- `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
- `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
- `application/vnd.openxmlformats-officedocument.presentationml.presentation`
- `application/vnd.oasis.opendocument.spreadsheet`
- `application/vnd.oasis.opendocument.presentation`
- `application/x-vnd.oasis.opendocument.text`
- `image/png`
- `image/jpeg`
- `image/jpg`

If the file is not found, try using other tools like `search_files` to find the file the user is requesting using keywords.

The following sample demonstrate how to use `curl` to invoke the `read_file_content` MCP tool.

| Curl Request |
|---|
| ```bash curl --location 'https://drivemcp.googleapis.com/mcp/v1' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "read_file_content", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' ``` |

## Input Schema

Request to read file content with support for fetching comments.

### ReadFileContentRequest

| JSON representation |
|---|
| ``` { "fileId": string, "includeComments": boolean } ``` |

| Fields ||
|---|---|
| `fileId` | `string` Required. The ID of the file to retrieve. |
| `includeComments` | `boolean` Whether to include comments in the response. Comments will be inlined in the text content of the file with a mapping to the comment threads. |

## Output Schema

Response to read file content.

### ReadFileContentResponse

| JSON representation |
|---|
| ``` { "contentAnchoredComments": [ { object (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/read_file_content#Output.Schema.CommentThread`) } ], "unanchoredComments": [ { object (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/read_file_content#Output.Schema.CommentThread`) } ], "fileContent": string "textFormattingNotSupported": boolean // End of list of possible types for union field // `_text_formatting_not_supported`. "commentsNotSupported": boolean } ``` |

| Fields ||
|---|---|
| `contentAnchoredComments[]` | ``object (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/read_file_content#Output.Schema.CommentThread`)`` Comment threads referenced in the returned file_content. |
| `unanchoredComments[]` | ``object (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/read_file_content#Output.Schema.CommentThread`)`` Comment threads that could not be anchored to specific content in the returned file. |
| Union field `_file_content`. `_file_content` can be only one of the following: ||
| `fileContent` | `string` Drive file content returned in text format. May be empty if the file is not supported for text formatting. Can include comment references if include_comments is true in the request. |
| Union field `_text_formatting_not_supported`. `_text_formatting_not_supported` can be only one of the following: ||
| `textFormattingNotSupported` | `boolean` Whether text formatting is supported for this file. If true, file_content will be empty. |
| Union field `_comments_not_supported`. `_comments_not_supported` can be only one of the following: ||
| `commentsNotSupported` | `boolean` Whether returning comments is supported for this file. Only present if include_comments is true in the request and comments are not supported. |

### CommentThread

| JSON representation |
|---|
| ``` { "replies": [ { object (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/add_comment_reply#Output.Schema.Post`) } ], "commentId": string "status": enum (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/read_file_content#Output.Schema.Status`) "headPost": { object (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/add_comment_reply#Output.Schema.Post`) } } ``` |

| Fields ||
|---|---|
| `replies[]` | ``object (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/add_comment_reply#Output.Schema.Post`)`` The replies to the first post in the comment thread. |
| Union field `_comment_id`. `_comment_id` can be only one of the following: ||
| `commentId` | `string` The id of the comment thread. This is the same id as the initial comment. |
| Union field `_status`. `_status` can be only one of the following: ||
| `status` | ``enum (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/read_file_content#Output.Schema.Status`)`` The status of the comment thread. |
| Union field `_head_post`. `_head_post` can be only one of the following: ||
| `headPost` | ``object (`https://developers.google.com/workspace/drive/api/reference/mcp/tools_list/add_comment_reply#Output.Schema.Post`)`` The first post in the comment thread. |

### Post

| JSON representation |
|---|
| ``` { "postId": string "content": string "authorName": string "modifiedTime": string } ``` |

| Fields ||
|---|---|
| Union field `_post_id`. `_post_id` can be only one of the following: ||
| `postId` | `string` The id of the post. |
| Union field `_content`. `_content` can be only one of the following: ||
| `content` | `string` The content of the post. |
| Union field `_author_name`. `_author_name` can be only one of the following: ||
| `authorName` | `string` The name of the author of the post. |
| Union field `_modified_time`. `_modified_time` can be only one of the following: ||
| `modifiedTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` The time that the post was last modified. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |

### Timestamp

| JSON representation |
|---|
| ``` { "seconds": string, "nanos": integer } ``` |

| Fields ||
|---|---|
| `seconds` | `string (https://developers.google.com/discovery/v1/type-format format)` Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
| `nanos` | `integer` Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |

### Status

Defines the status of a comment thread.

| Enums ||
|---|---|
| `STATUS_UNSPECIFIED` |   |
| `OPEN` |   |
| `RESOLVED` |   |

### Tool Annotations

Destructive Hint: ❌ \| Idempotent Hint: ✅ \| Read Only Hint: ✅ \| Open World Hint: ❌

## Authorization Scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/drive`
- `https://www.googleapis.com/auth/drive.appdata`
- `https://www.googleapis.com/auth/drive.file`
- `https://www.googleapis.com/auth/drive.meet.readonly`
- `https://www.googleapis.com/auth/drive.metadata`
- `https://www.googleapis.com/auth/drive.metadata.readonly`
- `https://www.googleapis.com/auth/drive.photos.readonly`
- `https://www.googleapis.com/auth/drive.readonly`