## Tool: `update_file`

Call this tool to update the metadata of, or lock/unlock, a Google Drive file.

If the file is not found, try using other tools like `search_files` to find the file the user is attempting to update. For moving files, use `search_files` to identify the destination parent id. For folders, `folderColorRgb` changes the folder color. It must be an RGB hex string in the format `#RRGGBB` and is snapped to the nearest color in Drive's folder color palette.

The following code sample shows how to use `curl` to call the `update_file` 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": "update_file", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' ``` |

## Input Schema

Request to update a file.

### UpdateFileRequest

| JSON representation |
|---|
| ``` { "fileId": string, "title": string, "parentId": string, "description": string, "folderColorRgb": string, "inheritedPermissionsDisabled": boolean, "readOnly": boolean, "readOnlyReason": string, "writersCanShare": boolean, "downloadRestriction": { object (`DownloadRestriction`) }, "etag": string, "starred": boolean } ``` |

| Fields ||
|---|---|
| `fileId` | `string` Required. The ID of the file to update. |
| `title` | `string` The updated title of the file. If provided, must not be empty. |
| `parentId` | `string` The updated parent id of the file. If the file has an existing parent, it will be replaced, resulting in a folder move. If provided, must not be empty. |
| `description` | `string` Optional. The updated description of the file. If provided as an empty string, clears the existing description. |
| `folderColorRgb` | `string` The updated color of the folder, as an RGB hex string in the format `#RRGGBB` (e.g. `#4986e7`). Only applies to folders. The color is snapped to the nearest color in Drive's folder color palette. |
| `inheritedPermissionsDisabled` | `boolean` Optional. Whether inherited permissions are disabled on the folder. Set to true to disable inherited permissions (restricting access to only users with direct permissions on the folder), or false to re-enable inherited permissions. Only supported for folders. |
| `readOnly` | `boolean` Optional. Whether the content of the file is read-only. Setting this to true locks the file to prevent edits, comments, suggestions, and title changes. Setting this to false unlocks a previously locked file. |
| `readOnlyReason` | `string` Optional. Optional reason for why the file was put into a read-only (locked) state. Can only be set when `readOnly` is set to true. |
| `writersCanShare` | `boolean` Optional. Whether users with only writer permission can modify the file's permissions and share the file. |
| `downloadRestriction` | ``object (`DownloadRestriction`)`` Optional. Restrictions applied to downloading, printing, and copying the file. Only the file's owner (or an organizer in a shared drive) can modify download restrictions. Cannot be set on folders, Google Sites, or Google Forms. |
| `etag` | `string` Optional. Opaque version token used for optimistic concurrency control (preventing concurrent edit conflicts). If set, the update fails with FAILED_PRECONDITION if the file has been modified since the etag was returned. OMIT this field if you have not previously retrieved the file. Never fabricate or manually format an etag value. ONLY pass the exact, unaltered string previously received in `File.etag` or `Revision.fileEtag` from a prior read or write operation. |
| `starred` | `boolean` Updates the starred state of the file. |

### DownloadRestriction

| JSON representation |
|---|
| ``` { "restrictedReader": boolean, "restrictedWriter": boolean } ``` |

| Fields ||
|---|---|
| `restrictedReader` | `boolean` Optional. Whether download, print, and copy are restricted for readers (viewers) and commenters. |
| `restrictedWriter` | `boolean` Optional. Whether download, print, and copy are restricted for writers (editors). If true, download, print, and copy are also restricted for readers and commenters. |

## Output Schema

A file resource.

### File

| JSON representation |
|---|
| ``` { "id": string, "title": string, "parentId": string, "followUps": [ { object (`FollowUp`) } ], "mimeType": string, "fileSize": string, "description": string, "fileExtension": string, "contentSnippet": string, "viewUrl": string, "sharedWithMeTime": string, "createdTime": string, "modifiedTime": string, "viewedByMeTime": string, "owner": string, "canAddChildren": boolean, "resourceUri": string, "trashed": boolean, "readOnly": boolean, "readOnlyReason": string, "inheritedPermissionsDisabled": boolean, "starred": boolean, "folderProperties": { object (`FolderProperties`) }, "sharedDriveId": string, "shortcutDetails": { object (`ShortcutDetails`) }, "writersCanShare": boolean, "downloadRestriction": { object (`DownloadRestriction`) }, "capabilities": { object (`FileCapabilities`) }, "etag": string, "projectMetadata": { object (`ProjectMetadata`) }, "ownerName": string, "lastModifyingUserName": string, "lastModifyingUserEmail": string, "visibility": enum (`Visibility`), "lastCommentedTime": string, "externalityState": enum (`ExternalityState`) } ``` |

| Fields ||
|---|---|
| `id` | `string` The id of the file that was fetched. |
| `title` | `string` The title of the file. |
| `parentId` | `string` The (optional) id of the parent of the file. |
| `followUps[]` | ``object (`FollowUp`)`` Output only. Open follow-ups on this file for the requesting user. Empty when the user has nothing to act on. |
| `mimeType` | `string` The mime type of the file. |
| `fileSize` | `string (int64 format)` The size in bytes of the file. |
| `description` | `string` The description of the file. |
| `fileExtension` | `string` The original file extension of the file, this is only populated for files with content stored in Drive. |
| `contentSnippet` | `string` Generated snippet about the content of the file. |
| `viewUrl` | `string` The URL to view the file. |
| `sharedWithMeTime` | ``string (`Timestamp` format)`` The time that the file was shared with the requester. 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"`. |
| `createdTime` | ``string (`Timestamp` format)`` The time that the file was created. 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"`. |
| `modifiedTime` | ``string (`Timestamp` format)`` The most recent time at which the file was 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"`. |
| `viewedByMeTime` | ``string (`Timestamp` format)`` The most recent time at which the file was viewed by requester. 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"`. |
| `owner` | `string` The email address of the owner of the file. |
| `canAddChildren (deprecated)` | `boolean` > [!WARNING] > This item is deprecated! Deprecated: use `capabilities.canAddChildren`. |
| `resourceUri` | `string` The resource URI of the file. |
| `trashed` | `boolean` Whether the file is in the trash. |
| `readOnly` | `boolean` Whether the content of the file is read-only (locked). |
| `readOnlyReason` | `string` The reason why the file was put into a read-only (locked) state. |
| `inheritedPermissionsDisabled` | `boolean` Whether inherited permissions are disabled on this folder. This is always false for non-folder types. |
| `starred` | `boolean` Whether the file has been starred. |
| `folderProperties` | ``object (`FolderProperties`)`` Populated only for folders with special properties. |
| `sharedDriveId` | `string` The ID of the shared drive the file resides in. Only populated for items in shared drives. |
| `shortcutDetails` | ``object (`ShortcutDetails`)`` Populated only for shortcut files (mimeType = "application/vnd.google-apps.shortcut"). Top-level File fields describe the shortcut item itself. |
| `writersCanShare` | `boolean` Whether users with only writer permission can modify the file's permissions and share the file. |
| `downloadRestriction` | ``object (`DownloadRestriction`)`` Optional. Restrictions applied to downloading, printing, and copying the file. |
| `capabilities` | ``object (`FileCapabilities`)`` Output only. Capabilities of the file for the requester. |
| `etag` | `string` Output only. An opaque version identifier for the file that changes whenever the file is modified. |
| `projectMetadata` | ``object (`ProjectMetadata`)`` Output only. Populated only for Drive Projects (`mimeType` = `"application/vnd.google-apps.project"`) when project details are requested. Top-level File fields describe the project item itself. |
| `ownerName` | `string` Output only. Display name of the owner of the file. See `owner` for the email address. Only populated when `includeRichMetadata` is `true` on `GetFile` or `SearchFiles`. |
| `lastModifyingUserName` | `string` Output only. Display name of the user who last modified the file. Only populated when `includeRichMetadata` is `true` on `GetFile` or `SearchFiles`. |
| `lastModifyingUserEmail` | `string` Output only. Email address of the user who last modified the file. Only populated when `includeRichMetadata` is `true` on `GetFile` or `SearchFiles`. |
| `visibility` | ``enum (`Visibility`)`` Output only. Sharing visibility state of the file. Only populated when `includeRichMetadata` is `true` on `GetFile` or `SearchFiles`. |
| `lastCommentedTime` | ``string (`Timestamp` format)`` Output only. The time at which the file was last commented on. Only populated when `includeRichMetadata` is `true` on `GetFile` or `SearchFiles`. 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"`. |
| `externalityState` | ``enum (`ExternalityState`)`` Output only. Whether the file is shared with, owned by, or created by users outside of the requester's organization. See `ExternalityState` for precedence when more than one applies. Only populated when `includeExternalityState` is `true` on `GetFile`, `ListFiles`, or `SearchFiles`. |

### Timestamp

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

| Fields ||
|---|---|
| `seconds` | `string (int64 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. |

### FolderProperties

| JSON representation |
|---|
| ``` { "syncedComputer": boolean, "syncFolder": boolean } ``` |

| Fields ||
|---|---|
| `syncedComputer` | `boolean` Whether the folder is the root folder representing a synced computer or device. |
| `syncFolder` | `boolean` Whether the folder is a synced folder from a computer or device. |

### FollowUp

| JSON representation |
|---|
| ``` { "type": enum (`Type`), "commentId": string } ``` |

| Fields ||
|---|---|
| `type` | ``enum (`Type`)`` Output only. The kind of follow-up. |
| `commentId` | `string` Output only. The id of the comment thread that needs attention. Matches CommentThread.commentId. |

### ShortcutDetails

| JSON representation |
|---|
| ``` { "targetFileId": string, "targetMimeType": string } ``` |

| Fields ||
|---|---|
| `targetFileId` | `string` The ID of the file or folder that this shortcut points to. The target may no longer exist or be accessible to the requester. |
| `targetMimeType` | `string` The MIME type of the shortcut's target as recorded when the shortcut was created. It is not refreshed if the target later changes, and the target may no longer exist or be accessible to the requester. |

### DownloadRestriction

| JSON representation |
|---|
| ``` { "restrictedReader": boolean, "restrictedWriter": boolean } ``` |

| Fields ||
|---|---|
| `restrictedReader` | `boolean` Optional. Whether download, print, and copy are restricted for readers (viewers) and commenters. |
| `restrictedWriter` | `boolean` Optional. Whether download, print, and copy are restricted for writers (editors). If true, download, print, and copy are also restricted for readers and commenters. |

### FileCapabilities

| JSON representation |
|---|
| ``` { "canEdit": boolean, "canMoveItemWithinDrive": boolean, "canAddChildren": boolean, "canTrash": boolean } ``` |

| Fields ||
|---|---|
| `canEdit` | `boolean` Output only. Whether the requester can edit this file. |
| `canMoveItemWithinDrive` | `boolean` Output only. Whether the requester can move this item within its drive (My Drive or shared drive). |
| `canAddChildren` | `boolean` Output only. Whether the requester can add children to this folder. This is always false for non-folder types. |
| `canTrash` | `boolean` Output only. Whether the requester can move this file to the trash. |

### ProjectMetadata

| JSON representation |
|---|
| ``` { "sources": [ { object (`Source`) } ], "missionStatement": string, "emoji": string, "purpose": string } ``` |

| Fields ||
|---|---|
| `sources[]` | ``object (`Source`)`` Sources attached to the project. |
| `missionStatement (deprecated)` | `string` > [!WARNING] > This item is deprecated! Deprecated: use purpose. |
| `emoji` | `string` The project emoji. |
| `purpose` | `string` The project purpose. |

### Source

| JSON representation |
|---|
| ``` { "sourceId": string, "title": string, "driveSource": { object (`DriveSource`) }, "gmailSource": { object (`GmailSource`) }, "urlSource": { object (`UrlSource`) }, "chatSource": { object (`ChatSource`) }, "calendarSource": { object (`CalendarSource`) } } ``` |

| Fields ||
|---|---|
| `sourceId` | `string` Server-assigned identifier of the source within the project. |
| `title` | `string` Human-readable title of the source, if applicable. |
| Union field `resource`. What the source links to, with the IDs needed to read it. `resource` can be only one of the following: ||
| `driveSource` | ``object (`DriveSource`)`` Output only. A Drive file or folder. |
| `gmailSource` | ``object (`GmailSource`)`` Output only. A Gmail thread. |
| `urlSource` | ``object (`UrlSource`)`` Output only. A web page. |
| `chatSource` | ``object (`ChatSource`)`` Output only. A Google Chat space. |
| `calendarSource` | ``object (`CalendarSource`)`` Output only. A Google Calendar event. |
|   ||

### DriveSource

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

| Fields ||
|---|---|
| `fileId` | `string` Output only. The Drive item ID. |
| `mimeType` | `string` Output only. The MIME type of the Drive item, if known. |

### GmailSource

| JSON representation |
|---|
| ``` { "threadId": string } ``` |

| Fields ||
|---|---|
| `threadId` | `string` Output only. The thread ID in Gmail's server permanent ID format (for example, `thread-f:1570099985108600423`), which Gmail tools accept as is. |

### UrlSource

| JSON representation |
|---|
| ``` { "url": string } ``` |

| Fields ||
|---|---|
| `url` | `string` Output only. The URL of the web page. |

### Type

The kind of follow-up. Values may be added in the future.

| Enums ||
|---|---|
| `TYPE_UNSPECIFIED` | Unspecified type. |
| `ASSIGNMENT` | An open comment thread assigned to the requesting user. |
| `SUGGESTION` | An open suggested edit on a file the requesting user owns. |

### Visibility

Sharing visibility state of a file or folder. Values may be added in the future.

| Enums ||
|---|---|
| `VISIBILITY_UNSPECIFIED` | Visibility is unspecified. |
| `PUBLIC` | Anyone on the internet can find and access the item, including anonymous users. |
| `UNLISTED` | Anyone with the link can access the item, including anonymous users. |
| `PUBLIC_TO_DOMAIN` | Anyone in the owner's domain can access the item. |
| `UNLISTED_TO_DOMAIN` | Anyone in the owner's domain who has the link can access the item. |
| `PRIVATE` | The item is not shared with the link, to the domain, or to the public. Note that the item may still be shared with specific users or groups. |

### ExternalityState

Whether a file is shared with, owned by, or created by users outside of the requester's organization.

| Enums ||
|---|---|
| `EXTERNALITY_STATE_UNSPECIFIED` | The externality state is unknown. |
| `SHARED_EXTERNALLY` | The file is shared with users outside of the organization. It may also be owned by or created by external users. |
| `OWNED_EXTERNALLY` | The file is owned by a user outside of the organization, but is not shared externally. It may also be created by an external user. |
| `CREATOR_EXTERNAL` | The file was created by a user outside of the organization, but is neither shared externally nor owned externally. |
| `NOT_EXTERNAL` | The file is not shared with, owned by, or created by users outside of the organization. |
| `NOT_APPLICABLE` | Externality does not apply to the file, e.g. for consumer accounts. |

### Tool Annotations


[Tool annotations](https://modelcontextprotocol.io/specification/latest/schema#toolannotations) are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.


Along with the title string, the following boolean hints are defined as follows:

- `readOnlyHint`: If true, the tool doesn't modify its environment. Default: false.
- `destructiveHint`: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.
- `idempotentHint`: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.
- `openWorldHint`: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.

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`