Инструмент: 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.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/plaintoapplication/vnd.google-apps.document -
text/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 |
|---|
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 }' |
Схема ввода
Запрос на загрузку файла.
CreateFileRequest
| JSON-представление |
|---|
{ "title": string, "mimeType": string, "content": string, "parentId": string, "disableConversionToGoogleType": boolean } |
| Поля | |
|---|---|
title | Название файла. |
mimeType | MIME-тип загружаемого файла. |
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 | Идентификатор родительского файла. |
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. |
Схема вывода
Файловый ресурс.
Файл
| JSON-представление |
|---|
{ "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 } |
| Поля | |
|---|---|
id | Идентификатор полученного файла. |
title | Название файла. |
parentId | Идентификатор (необязательный) родительского файла. |
Объединенное поле | |
mimeType | MIME-тип файла. |
Объединенное поле | |
fileSize | Размер файла в байтах. |
Поле объединения | |
description | Описание файла. |
Объединенное поле | |
fileExtension | The original file extension of the file, this is only populated for files with content stored in Drive. |
Объединенное поле | |
contentSnippet | Сгенерированный фрагмент текста о содержимом файла. |
Объединенное поле | |
viewUrl | URL-адрес для просмотра файла. |
Поле объединения | |
sharedWithMeTime | The time that the file was shared with the requester. Используется RFC 3339, согласно которому генерируемый вывод всегда будет Z-нормализован и будет содержать 0, 3, 6 или 9 дробных знаков. Допускаются также смещения, отличные от "Z". Примеры: |
Поле объединения | |
createdTime | Время создания файла. Используется RFC 3339, согласно которому генерируемый вывод всегда будет Z-нормализован и будет содержать 0, 3, 6 или 9 дробных знаков. Допускаются также смещения, отличные от "Z". Примеры: |
Поле объединения | |
modifiedTime | Последнее время, когда файл был изменен. Используется RFC 3339, согласно которому генерируемый вывод всегда будет Z-нормализован и будет содержать 0, 3, 6 или 9 дробных знаков. Допускаются также смещения, отличные от "Z". Примеры: |
Объединенное поле | |
viewedByMeTime | The most recent time at which the file was viewed by requester. Используется RFC 3339, согласно которому генерируемый вывод всегда будет Z-нормализован и будет содержать 0, 3, 6 или 9 дробных знаков. Допускаются также смещения, отличные от "Z". Примеры: |
| |
owner | Адрес электронной почты владельца файла. |
Отметка времени
| JSON-представление |
|---|
{ "seconds": string, "nanos": integer } |
| Поля | |
|---|---|
seconds | Обозначает количество секунд UTC-времени с начала эпохи Unix 1970-01-01T00:00:00Z. Должно находиться в диапазоне от -62135596800 до 253402300799 включительно (что соответствует периоду с 0001-01-01T00:00:00Z по 9999-12-31T23:59:59Z). |
nanos | Неотрицательные доли секунды с разрешением в наносекунды. Это поле представляет собой наносекундную часть длительности, а не альтернативу секундам. Отрицательные значения секунд с дробными долями должны по-прежнему иметь неотрицательные значения в наносекундах, отсчитываемые вперед во времени. Должны быть в диапазоне от 0 до 999 999 999 включительно. |
Аннотации инструментов
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ❌ | Open World Hint: ✅