Tool: copy_file
Call this tool to copy an existing File in Google Drive. The tool allows specifying a new title and a parent folder for the copy. If the title is not specified, the copy title will be 'Copy of {original title}'. If the parent folder is not specified, the copy will be created in the same folder as the original file, unless the requesting user does not have write access to that folder, in which case the copy will be created in the user's root folder. Pregenerated file IDs (pregeneratedId) are supported when copying non-Google Workspace files. Returns the newly created File object upon successful copying.
The following code sample shows how to use curl to call the copy_file MCP tool.
| Curl Request |
|---|
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": "copy_file", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request to copy a file.
CopyFileRequest
| JSON representation |
|---|
{ "fileId": string, "title": string, "parentId": string, "pregeneratedId": string } |
| Fields | |
|---|---|
fileId |
Required. The ID of the file to copy. |
title |
The title of the newly created file. If empty, the title will be 'Copy of {original file title}'. |
parentId |
The parent id of the newly created file. If empty, the file will be created with the same parent as the original file. |
pregeneratedId |
Optional. The pregenerated id of the newly created file. Supported for binary/blob files; not supported for native Google Workspace document types. |
Output Schema
A file resource.
File
| JSON representation |
|---|
{ "id": string, "title": string, "parentId": string, "followUps": [ { object ( |
| Fields | |
|---|---|
id |
The id of the file that was fetched. |
title |
The title of the file. |
parentId |
The (optional) id of the parent of the file. |
followUps[] |
Output only. Open follow-ups on this file for the requesting user. Empty when the user has nothing to act on. |
mimeType |
The mime type of the file. |
fileSize |
The size in bytes of the file. |
description |
The description of the file. |
fileExtension |
The original file extension of the file, this is only populated for files with content stored in Drive. |
contentSnippet |
Generated snippet about the content of the file. |
viewUrl |
The URL to view the file. |
sharedWithMeTime |
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: |
createdTime |
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: |
modifiedTime |
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: |
viewedByMeTime |
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: |
owner |
The email address of the owner of the file. |
canAddChildren |
Deprecated: use |
resourceUri |
The resource URI of the file. |
trashed |
Whether the file is in the trash. |
readOnly |
Whether the content of the file is read-only (locked). |
readOnlyReason |
The reason why the file was put into a read-only (locked) state. |
inheritedPermissionsDisabled |
Whether inherited permissions are disabled on this folder. This is always false for non-folder types. |
starred |
Whether the file has been starred. |
folderProperties |
Populated only for folders with special properties. |
sharedDriveId |
The ID of the shared drive the file resides in. Only populated for items in shared drives. |
shortcutDetails |
Populated only for shortcut files (mimeType = "application/vnd.google-apps.shortcut"). Top-level File fields describe the shortcut item itself. |
writersCanShare |
Whether users with only writer permission can modify the file's permissions and share the file. |
downloadRestriction |
Optional. Restrictions applied to downloading, printing, and copying the file. |
capabilities |
Output only. Capabilities of the file for the requester. |
etag |
Output only. An opaque version identifier for the file that changes whenever the file is modified. |
projectMetadata |
Output only. Populated only for Drive Projects ( |
ownerName |
Output only. Display name of the owner of the file. See |
lastModifyingUserName |
Output only. Display name of the user who last modified the file. Only populated when |
lastModifyingUserEmail |
Output only. Email address of the user who last modified the file. Only populated when |
visibility |
Output only. Sharing visibility state of the file. Only populated when |
lastCommentedTime |
Output only. The time at which the file was last commented on. Only populated when 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: |
externalityState |
Output only. Whether the file is shared with, owned by, or created by users outside of the requester's organization. See |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
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 |
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 |
Whether the folder is the root folder representing a synced computer or device. |
syncFolder |
Whether the folder is a synced folder from a computer or device. |
FollowUp
| JSON representation |
|---|
{
"type": enum ( |
| Fields | |
|---|---|
type |
Output only. The kind of follow-up. |
commentId |
Output only. The id of the comment thread that needs attention. Matches CommentThread.commentId. |
ShortcutDetails
| JSON representation |
|---|
{ "targetFileId": string, "targetMimeType": string } |
| Fields | |
|---|---|
targetFileId |
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 |
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 |
Optional. Whether download, print, and copy are restricted for readers (viewers) and commenters. |
restrictedWriter |
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 |
Output only. Whether the requester can edit this file. |
canMoveItemWithinDrive |
Output only. Whether the requester can move this item within its drive (My Drive or shared drive). |
canAddChildren |
Output only. Whether the requester can add children to this folder. This is always false for non-folder types. |
canTrash |
Output only. Whether the requester can move this file to the trash. |
ProjectMetadata
| JSON representation |
|---|
{
"sources": [
{
object ( |
| Fields | |
|---|---|
sources[] |
Sources attached to the project. |
missionStatement |
Deprecated: use purpose. |
emoji |
The project emoji. |
purpose |
The project purpose. |
Source
| JSON representation |
|---|
{ "sourceId": string, "title": string, "driveSource": { object ( |
| Fields | |
|---|---|
sourceId |
Server-assigned identifier of the source within the project. |
title |
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 |
Output only. A Drive file or folder. |
gmailSource |
Output only. A Gmail thread. |
urlSource |
Output only. A web page. |
chatSource |
Output only. A Google Chat space. |
calendarSource |
Output only. A Google Calendar event. |
DriveSource
| JSON representation |
|---|
{ "fileId": string, "mimeType": string } |
| Fields | |
|---|---|
fileId |
Output only. The Drive item ID. |
mimeType |
Output only. The MIME type of the Drive item, if known. |
GmailSource
| JSON representation |
|---|
{ "threadId": string } |
| Fields | |
|---|---|
threadId |
Output only. The thread ID in Gmail's server permanent ID format (for example, |
UrlSource
| JSON representation |
|---|
{ "url": string } |
| Fields | |
|---|---|
url |
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 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/drivehttps://www.googleapis.com/auth/drive.appdatahttps://www.googleapis.com/auth/drive.file