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 "text_content" for text content. For non-UTF8 contents, use the "base64_content" field and base64 encode the data to set on that field.

Returns a single File object upon successful creation.

The following Google Drive 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

By default, the following conversions will be made for the following mime types:

  • text/plain to application/vnd.google-apps.document
  • text/csv to application/vnd.google-apps.spreadsheet

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

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

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

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

Curl Request
curl --location 'https://drivemcp.googleapis.com/mcp/v1' \
--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 tool's MCP 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
}
Fields
title

string

The title of the file.

mimeType

string

DEPRECATED. DO NOT USE!! Set content_mime_type instead.

contentMimeType

string

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

content

string

The content of the file encoded as base64. The content field should always be base64 encoded regardless of the mime type of the file. DEPRECATED. Use base64_content or text_content instead.

base64Content

string

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

textContent

string

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

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 an application/vnd.google-apps.document. Has no effect for types that do not have a Google equivalent.

Output Schema

A file resource.

File

JSON representation
{
  "id": string,
  "title": string,
  "parentId": string,

  "mimeType": string

  "fileSize": string

  "description": string

  "fileExtension": string

  "contentSnippet": string

  "viewUrl": string

  "sharedWithMeTime": string

  "createdTime": string

  "modifiedTime": string

  "viewedByMeTime": string

  "owner": string

  "canAddChildren": boolean
}
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.

Union field _mime_type.

_mime_type can be only one of the following:

mimeType

string

The mime type of the file.

Union field _file_size.

_file_size can be only one of the following:

fileSize

string (int64 format)

The size in bytes of the file.

Union field _description.

_description can be only one of the following:

description

string

The description of the file.

Union field _file_extension.

_file_extension can be only one of the following:

fileExtension

string

The original file extension of the file, this is only populated for files with content stored in Drive.

Union field _content_snippet.

_content_snippet can be only one of the following:

contentSnippet

string

Generated snippet about the content of the file.

Union field _view_url.

_view_url can be only one of the following:

viewUrl

string

The URL to view the file.

Union field _shared_with_me_time.

_shared_with_me_time can be only one of the following:

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

Union field _created_time.

_created_time can be only one of the following:

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

Union field _modified_time.

_modified_time can be only one of the following:

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

Union field _viewed_by_me_time.

_viewed_by_me_time can be only one of the following:

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

Union field _owner.

_owner can be only one of the following:

owner

string

The email address of the owner of the file.

Union field _can_add_children.

_can_add_children can be only one of the following:

canAddChildren

boolean

Whether the requester can add children to this folder. This is always false for non-folder types.

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.

Tool Annotations

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