Tool: create_file
Call this tool to create or upload a File to Google Drive.
If uploading a file, the content needs to be base64 encoded into the content field regardless of the mimetype of the file being uploaded.
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.documentapplication/vnd.google-apps.spreadsheetapplication/vnd.google-apps.presentation
By default, the following conversions will be made for the following mime types:
text/plaintoapplication/vnd.google-apps.documenttext/csvtoapplication/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.
The following sample demonstrate how to use curl to invoke the create_file MCP tool.
| Curl Request |
|---|
curl --location 'https://drivemcp.googleapis.com/mcp' \ --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 MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request to upload a file.
CreateFileRequest
| JSON representation |
|---|
{ "title": string, "mimeType": string, "content": string, "parentId": string, "disableConversionToGoogleType": boolean } |
| Fields | |
|---|---|
title |
The title of the file. |
mimeType |
The mime type of the file to upload. |
content |
The content of the file encoded as base64. The content field should always be base64 encoded regardless of the mime type of the file. |
parentId |
The parent id of the file. |
disableConversionToGoogleType |
If true, the file will not be converted to a Google type. Has no effect for mime 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 } |
| 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. |
Union field
|
|
mimeType |
The mime type of the file. |
Union field
|
|
fileSize |
The size in bytes of the file. |
Union field
|
|
description |
The description of the file. |
Union field
|
|
fileExtension |
The original file extension of the file, this is only populated for files with content stored in Drive. |
Union field
|
|
contentSnippet |
Generated snippet about the content of the file. |
Union field
|
|
viewUrl |
The URL to view the file. |
Union field
|
|
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: |
Union field
|
|
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: |
Union field
|
|
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: |
Union field
|
|
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: |
Union field
|
|
owner |
The email address of the owner of the file. |
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. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ❌ | Open World Hint: ✅