MCP Tools Reference: drivemcp.googleapis.com

Tool: create_file

Call this tool to create or upload a File to Google Drive.

If uploading content, prefer textContent for text content. For non-UTF8 contents, use the base64Content field and base64 encode the data to set on that field.

Returns a single File object upon successful creation.

The following Google first-party mime types can be created without providing content:

  • application/vnd.google-apps.document
  • application/vnd.google-apps.spreadsheet
  • application/vnd.google-apps.presentation

Folders can be created by setting the mime type to application/vnd.google-apps.folder.

When uploading content, the contentMimeType field is required and should match the type of the content being uploaded.

By default, supported content will be converted to Google first-party mime types.

To disable conversions for first-party mime types, set disableConversionToGoogleType to true.

Pregenerated file IDs (pregeneratedId) are supported for non-Google Workspace files and folders (application/vnd.google-apps.folder). When uploading content with pregeneratedId, disableConversionToGoogleType must be set to true.

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

Input Schema

Request to upload a file.

CreateFileRequest

JSON representation
{
  "title": string,
  "mimeType": string,
  "contentMimeType": string,
  "content": string,
  "base64Content": string,
  "textContent": string,
  "parentId": string,
  "disableConversionToGoogleType": boolean,
  "inheritedPermissionsDisabled": boolean,
  "pregeneratedId": string
}
Fields
title

string

Required. The title of the file.

mimeType
(deprecated)

string

Deprecated: DO NOT USE!! Set contentMimeType instead.

contentMimeType

string

The mime type of the content being uploaded. Required when any type of content is provided.

content
(deprecated)

string

Deprecated: Use base64Content or textContent instead. The content of the file encoded as base64. The content field should always be base64 encoded regardless of the mime type of the file.

base64Content

string

Optional. The base64 encoded content to upload. It's an error to set this and textContent.

textContent

string

Optional. The (UTF-8) text content to upload. It's an error to set this and base64Content.

parentId

string

The parent id of the file.

disableConversionToGoogleType

boolean

Set to true to retain the passed in content mime type and not convert to a Google type. For example, without this a text/plain content mime type will be converted to to application/vnd.google-apps.document. Has no effect for types that do not have a Google equivalent.

inheritedPermissionsDisabled

boolean

Set to true to disable inherited permissions on the created folder, restricting access to only users with direct permissions on the folder.

pregeneratedId

string

Optional. The pregenerated id of the file to create. Supported for binary/blob files and folders (application/vnd.google-apps.folder); not supported for native Google Workspace document types. When uploading content with a pregenerated id, disableConversionToGoogleType must be set to true.

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

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

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 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