google-tools
v0.2.0Google tools for coding agents: Sheets, Gmail, Drive and Google Cloud.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
google_account_read Read Google accounts
Report the Google accounts set up for these tools, and check one against Google. method `list` returns every account, sorted by label: where its credential comes from (`source`: `variable` or `file`, with the variable's name in `variable`; never the credential), the address it was logged in as, the scopes it holds, the toolsets those scopes cover (`toolsets`, and `read_only_toolsets` where only their read scopes are held), and a `problem` with one `fix` when its credential cannot be read. It reads local state only and does not contact Google. method `check` takes an optional `account` (needed…
| Parameter | Type | Description |
|---|---|---|
method * | string | |
account | string | check: the account's label. Left out, the only account is checked; with several accounts, the call fails and lists them. list takes none. |
google_sheets_read Read Google Sheets
Read Google spreadsheets. method `list` returns the account's spreadsheets, most recently modified first (`spreadsheet_id`, `name`, `modified_time`, `url`), optionally only those whose name contains `query`, up to `limit` (default 20, at most 100); a `next_page_token` that is not null goes in `page_token` for the next page. It reads names and dates only, never cell values. method `view` returns a spreadsheet's structure: its title, locale and time zone, and for each tab its `sheet_id`, `title`, position, whether it is hidden, its size, its frozen rows and columns and its tables with their A1 `…
| Parameter | Type | Description |
|---|---|---|
method * | string | |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
fit | string | snapshot: `width` (the default), `height`, `page` (both) or `none` (actual size). |
gridlines | boolean | snapshot: print the gridlines; default true. |
key | string | metadata: only the metadata with this key, exactly. |
limit | integer | list: how many spreadsheets to return, newest first (1 to 100, default 20). |
page_token | string | list: the `next_page_token` of the previous call, for the next page. |
pages | integer | snapshot: how many pages of the PDF to render to images (1 to 10, default 3). |
paper | string | snapshot: the paper size: `a4` (the default), `a3`, `letter`, `legal` or `tabloid`. |
pivots | boolean | structure: `true` also lists the pivot tables of the tabs read (default false, which leaves `pivots` null). It reads every cell of the tabs, so it is slower on large tabs. |
portrait | boolean | snapshot: portrait orientation; default false (landscape). |
query | string | list: only spreadsheets whose name contains this text. |
range | string | snapshot: a closed block of the tab in A1 notation with both corners (`A1:F40`, `Sheet1!A1:F40`); left out, the whole tab. |
ranges | array | values: the ranges to read, in A1 notation (`Sheet1!A1:C10`, `'My tab'!A:C`, `Sheet1!2:5`, or a tab's name for all of it). format: the same, at most 20. |
render | string | values: `formatted` (as shown in the sheet; the default), `unformatted` (numbers and booleans as stored, dates as shown) or `formula` (the formula of a cell that has one). |
spreadsheet | string | view, values, format, structure, metadata: the spreadsheet's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…). |
tab | string | snapshot: the tab's title; left out, the first tab (or the tab `range` names). |
tabs | array | structure: the titles of the tabs to read; left out, every tab. metadata: only the metadata on these tabs (and their rows and columns); left out, all of it, the spreadsheet's own included. |
value | string | metadata: only the metadata with this value, exactly. |
google_sheets_append Append rows to Google Sheets
Add rows below the data of a Google spreadsheet, in one of two forms: `range` (the A1 range of the block of data, such as `Log!A:E`) appends after its last row; `table` (a native table's id or name) appends to the table's first free rows and the table grows. Give exactly one. `values` are rows of text, numbers and booleans, at most 10000 cells in all; `null` and `""` leave a cell empty. With `range`, values are read as if typed into the sheet (formulas run, numbers and dates are recognised) and `raw: true` stores them as given; the result says the range, rows and cells Google wrote. With `tabl…
| Parameter | Type | Description |
|---|---|---|
spreadsheet * | string | The spreadsheet's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…). |
values * | array | The rows to append: arrays of text, numbers and booleans, in column order. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
range | string | The A1 range of the block of data to add rows after (`Log!A:E`, `'My tab'!A1`, or a tab's name); the rows go below its last row. Give this or `table`. |
raw | boolean | true: store every value as given, so `=SUM(A1:A2)` stays text and `3/4` is not turned into a date. Default false: values are read as if typed into the sheet, so formulas run and numbers and dates are… |
table | string | A native table's id or name (the `tables` of google_sheets_read `view`); the rows go in the table's first free rows and it grows. Give this or `range`. |
google_sheets_edit Overwrite Google Sheets cells
Overwrite cells of a Google spreadsheet. Each of 1 to 500 `data` items gives an A1 `range` and `values` (rows of text, numbers and booleans), written from the range's top-left cell; every row holds at least one cell, and a call carries at most 10000 cells in all. In a value, `null` leaves the cell as it is and `""` empties it. Values are read as if typed into the sheet (formulas run, numbers and dates are recognised); `raw: true` stores them as given. Read the rows first, then name a header cell and an id cell of the rows being changed, or the mark they carry, in `expect` (up to 200, each `{ r…
| Parameter | Type | Description |
|---|---|---|
data * | array | 1 to 500 ranges and the rows to write into each. |
spreadsheet * | string | The spreadsheet's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…). |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
expect | array | 1 to 200 guards the call makes right now, each `{ range, value }` (the cell shows that, as displayed) or `{ range, metadata: { key, value? }, along? }` (the row, or with `along: "columns"` the column,… |
raw | boolean | true: store every value as given, so `=SUM(A1:A2)` stays text and `3/4` is not turned into a date. Default false: values are read as if typed into the sheet, so formulas run and numbers and dates are… |
google_sheets_clear Clear Google Sheets cells
Empty the values of 1 to 100 A1 ranges of a Google spreadsheet; formatting, tables and the rest of the sheet stay. Read the rows first, then name a header cell and an id cell of the rows being cleared, or the mark they carry, in `expect` (up to 200, each `{ range, value }` (the cell shows that, as displayed) or `{ range, metadata: { key, value? }, along? }` (the row, or with `along: "columns"` the column, of the one cell `range` carries that developer metadata, the mark google_sheets_read's `metadata` method lists)): if any differs, nothing is cleared and the call fails as `stale` with the cel…
| Parameter | Type | Description |
|---|---|---|
ranges * | array | 1 to 100 ranges to empty, in A1 notation (`Plan!B2:D4`, `'My tab'!A:C`, `Plan!2:5`, or a tab's name for all of it). Only values are cleared; formatting stays. |
spreadsheet * | string | The spreadsheet's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…). |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
expect | array | 1 to 200 guards the call makes right now, each `{ range, value }` (the cell shows that, as displayed) or `{ range, metadata: { key, value? }, along? }` (the row, or with `along: "columns"` the column,… |
google_sheets_create Create a Google spreadsheet
Create a new Google spreadsheet in the account's Drive root, owned by the account, with the given `title` and, when `tabs` is given, those tabs in order (otherwise Google adds one tab, `Sheet1`). The result gives the new spreadsheet's id, its URL and its tabs. The new spreadsheet is visible only to the account until it is shared. It is not idempotent: calling it twice creates two spreadsheets. Use google_sheets_tab_add to add a tab to an existing spreadsheet and google_sheets_append or google_sheets_edit to fill it. `account` is needed when several accounts are set up.
| Parameter | Type | Description |
|---|---|---|
title * | string | The new spreadsheet's title. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
tabs | array | The titles of the tabs to start with, in order. Left out, Google adds one tab, `Sheet1`. |
google_sheets_tab_add Add a tab to a Google spreadsheet
Add a new tab (sheet) to an existing Google spreadsheet, by `spreadsheet` (its id or URL). `title` must not be used by another tab of the spreadsheet, ignoring case, or the call is refused before it writes. `index` is the tab's position counted from 0 (left out, it goes last); `rows` and `columns` set its size (left out, Google's default). The result gives the new tab's id, title, position and size. It is not idempotent: a second call with the same title is refused. Use google_sheets_create for a new spreadsheet and google_sheets_append or google_sheets_edit to fill the tab. `account` is neede…
| Parameter | Type | Description |
|---|---|---|
spreadsheet * | string | The spreadsheet's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…). |
title * | string | The new tab's title; no tab may have it already. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
columns | integer | How many columns the tab starts with (1 to 18278). Left out, Google's default. |
index | integer | The new tab's position, counted from 0. Left out, it goes after the last tab. |
rows | integer | How many rows the tab starts with (1 to 100000). Left out, Google's default. |
google_sheets_format Format a Google spreadsheet
Format a Google spreadsheet's cells, rows, columns and tabs, by `spreadsheet` (its id or URL): 1 to 100 `operations` that apply in order as one batch, so all of them land or none does. It never changes a cell's value and never removes anything; applying the same operations again leaves the same result. Each operation is an object with `op` and its arguments, and the ranges of an operation are A1 notation in `range` or `ranges` (a block, whole rows `3:5`, whole columns `B:D`, or a tab's name for all of it). `format` sets only the properties given on cells (`bold`, `italic`, `underline`, `strike…
google_sheets_add Add rows and tabs to a Google spreadsheet
Add rows, columns, tabs, tables, conditional rules, data validation, filters, charts, pivot tables and developer metadata to a Google spreadsheet, by `spreadsheet` (its id or URL): 1 to 100 `operations` that apply in order as one batch, so all of them land or none does. It never removes or overwrites a cell or an object a person made, but it is not idempotent: applying the same operations again adds again. Each operation is an object with `op` and its arguments. `insert` takes a `range` of whole rows (`Plan!5:7`) or whole columns (`Plan!C:D`) and inserts as many empty ones as it spans before t…
google_sheets_restructure Restructure a Google spreadsheet
Delete, move or merge rows, columns, cells and tabs of a Google spreadsheet, rename or reconfigure the spreadsheet, or change or remove its tables, conditional rules, data validation, filters, charts, pivot tables and developer metadata, by `spreadsheet` (its id or URL): 1 to 100 `operations` that apply in order as one batch, so all of them land or none does. Each operation is an object with `op` and its arguments. `delete` removes whole rows or whole columns with their contents (`range` or `ranges`; several on one tab go from the bottom or the right up, and none may overlap another); `move` t…
google_sheets_transform Transform a Google spreadsheet
Rewrite the data of a Google spreadsheet, by `spreadsheet` (its id or URL): 1 to 100 `operations` that apply in order as one batch, so all of them land or none does. Each operation is an object with `op` and its arguments; the ones that take a closed block need both its corners (`Plan!A1:D20`), not whole rows or columns. `sort` sorts the rows of the block `range` by `by` (1 to 10 `{ column, order: asc|desc }`, the first taking precedence); `find_replace` replaces `find` with `replacement` (default: nothing, which removes it) in one of `range`, a whole `tab` or `all_tabs: true`, matching as `ma…
google_sheets_protect Change who can edit a Google spreadsheet
Change who may edit parts of a Google spreadsheet, by `spreadsheet` (its id or URL): 1 to 100 `operations` that apply in order as one batch, so all of them land or none does. Each operation is an object with `op` and its arguments. `protect` protects `range` (a block such as `Plan!A1:C20`, or a whole tab by its title alone, `Plan`) so that only its editors may change it: `editors` (up to 10 email addresses, lower-cased and deduplicated; none, or an empty list, leaves only you), `label`, `warning_only` (default false; `true` lets anyone who can edit the file edit after a warning, and takes no e…
| Parameter | Type | Description |
|---|---|---|
operations * | array | 1 to 100 operations, each an object with an `op` (protect, protect_update, protect_delete) and that operation's arguments; they apply in order, and all of them land or none does. |
spreadsheet * | string | The spreadsheet's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…). |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
google_gmail_read Read Gmail
Read the account's Gmail. method `search` takes a Gmail `query` (`from:ann@example.com newer_than:7d has:attachment`; left out, the newest mail) and returns up to `limit` messages (default 10, at most 50), newest first, as `messages` (`message_id`, `thread_id`, `from`, `to`, `cc`, `subject`, `date`, `snippet`, `labels`), never the body; Spam and Trash are left out unless `include_spam_trash` is true, `result_size_estimate` is Google's rough count, and a `next_page_token` that is not null goes in `page_token` for the next page. method `message` takes a `message_id` from a search and returns the…
| Parameter | Type | Description |
|---|---|---|
method * | string | |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
draft_id | string | draft: the id a `drafts` result gave as `draft_id`. |
include_spam_trash | boolean | search: `true` also searches Spam and Trash (default false). |
limit | integer | search, drafts: how many messages or drafts to return (1 to 50, default 10). |
message_id | string | message, attachment: the id a `search` or `thread` result gave as `message_id`. |
name | string | attachment: what to name the saved file, without its extension (which is the attachment's own); left out, the attachment's file name. |
page_token | string | search, drafts: the `next_page_token` of the previous call, for the next page. |
part | string | attachment: the `part` of an entry in the `attachments` of a `message` or `thread` result. |
query | string | search, drafts: Gmail search syntax (`from:ann@example.com newer_than:7d has:attachment`); left out, the newest mail or every draft. |
thread_id | string | thread: the id a `search` or `message` result gave as `thread_id`. |
google_gmail_send Send Gmail
Send an email from the account: a new mail, or a reply that joins the thread of `reply_to` (a `message_id` a read gave, which sets `In-Reply-To`, `References` and the thread, and `Re: ` and the original's subject when `subject` is left out). `to` takes 1 to 100 addresses, `cc` and `bcc` up to 100 each and at most 100 in all, each once; an address is plain (`name@example.com`), never `Name <name@example.com>`. A new mail needs a `subject`. `body` is 1 to 200000 characters of text, or HTML with `html: true` (a text version is sent beside it). `attachments` takes up to 20 absolute paths, 25 MiB i…
| Parameter | Type | Description |
|---|---|---|
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
attachments | array | Files to attach, 1 to 20 absolute paths inside the upload directories a person set up (none by default), 25 MiB in all. |
bcc | array | Blind-copied recipients, who are seen by none of the others: up to 100 plain addresses. |
body | string | The text of the mail, 1 to 200000 characters; HTML when `html` is true. Needed unless `draft_id` is given. |
cc | array | Copied recipients, who are seen by all: up to 100 plain addresses. |
draft_id | string | Sends this existing draft as it is (the `draft_id` of `google_gmail_read` method `drafts` or of a draft tool) instead of composing a mail; `to`, `cc`, `bcc`, `subject`, `body`, `html`, `reply_to` and… |
html | boolean | `true` sends `body` as HTML, with a text version made from it beside it (default false: plain text). |
reply_to | string | Replies to this message: the `message_id` a read gave. The mail joins its thread and refers to it; the recipients are still the ones given here. |
subject | string | The subject; needed for a new mail. A reply without one gets `Re: ` and the subject of the mail it answers. |
to | array | The recipients (needed unless `draft_id` is given): up to 100 plain addresses. |
google_gmail_draft_create Create Gmail draft
Create a draft in the account's Gmail: a mail kept unsent, which reaches no one until it is sent with `google_gmail_send` and the returned `draft_id`. It takes the mail arguments of `google_gmail_send`: `cc`, `bcc`, `subject` (needed for a new mail), `body` (1 to 200000 characters of text, or HTML with `html: true`), `reply_to` (a `message_id` a read gave, so the draft joins its thread) and `attachments` (up to 20 absolute paths, 25 MiB in all, inside the upload directories a person set up). `to` takes 0 to 100 addresses, plain (`name@example.com`), each once; a draft with none cannot be sent…
| Parameter | Type | Description |
|---|---|---|
body * | string | The text of the mail, 1 to 200000 characters; HTML when `html` is true. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
attachments | array | Files to attach, 1 to 20 absolute paths inside the upload directories a person set up (none by default), 25 MiB in all. |
bcc | array | Blind-copied recipients, who are seen by none of the others: up to 100 plain addresses. |
cc | array | Copied recipients, who are seen by all: up to 100 plain addresses. |
html | boolean | `true` sends `body` as HTML, with a text version made from it beside it (default false: plain text). |
reply_to | string | Replies to this message: the `message_id` a read gave. The mail joins its thread and refers to it; the recipients are still the ones given here. |
subject | string | The subject; needed for a new mail. A reply without one gets `Re: ` and the subject of the mail it answers. |
to | array | The recipients, possibly none while the mail is a draft (one is needed to send it): up to 100 plain addresses. |
google_gmail_draft_edit Edit Gmail draft
Replace the whole message of the draft `draft_id` (a `draft_id` that `google_gmail_read` method `drafts` or a draft tool gave) with a new one. The arguments are the whole new message, the same as `google_gmail_draft_create` takes: nothing is kept from the old one, so a `cc`, a `bcc`, an attachment or a `reply_to` left out is gone from the draft. The draft's `message_id` changes with the edit. The prompt shows the subject and the number of recipients of the draft it replaces, as Google holds them. Returns the draft's `draft_id`, its new `message_id` and its `thread_id`. `account` is needed when…
| Parameter | Type | Description |
|---|---|---|
body * | string | The text of the mail, 1 to 200000 characters; HTML when `html` is true. |
draft_id * | string | The id of the draft: the `draft_id` that `google_gmail_read` method `drafts` or a draft tool gave. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
attachments | array | Files to attach, 1 to 20 absolute paths inside the upload directories a person set up (none by default), 25 MiB in all. |
bcc | array | Blind-copied recipients, who are seen by none of the others: up to 100 plain addresses. |
cc | array | Copied recipients, who are seen by all: up to 100 plain addresses. |
html | boolean | `true` sends `body` as HTML, with a text version made from it beside it (default false: plain text). |
reply_to | string | Replies to this message: the `message_id` a read gave. The mail joins its thread and refers to it; the recipients are still the ones given here. |
subject | string | The subject; needed for a new mail. A reply without one gets `Re: ` and the subject of the mail it answers. |
to | array | The recipients, possibly none while the mail is a draft (one is needed to send it): up to 100 plain addresses. The whole new message: nothing is kept from the old one. |
google_gmail_draft_delete Delete Gmail draft
Delete the draft `draft_id` (a `draft_id` that `google_gmail_read` method `drafts` or a draft tool gave) permanently: Gmail does not keep a deleted draft in the Trash, and it cannot be undone. One draft per call. The prompt shows the draft's subject, its recipients and its date as Google holds them. Returns the `draft_id` and `deleted: true`. `account` is needed when several accounts are set up.
| Parameter | Type | Description |
|---|---|---|
draft_id * | string | The id of the draft: the `draft_id` that `google_gmail_read` method `drafts` or a draft tool gave. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
google_gmail_label Change Gmail labels
Add and remove labels on Gmail messages (`messages`, 1 to 1000 `message_id`s) or on threads (`threads`, 1 to 100 `thread_id`s), as `google_gmail_read` gives them; give exactly one of the two. `add_labels` and `remove_labels` take 1 to 20 labels each, and a label in both is refused. A label is named by a user label's name (exact, else ignoring case when only one label matches) or its id from `google_gmail_read` method `labels`, or by a system id: `INBOX`, `UNREAD`, `STARRED`, `IMPORTANT`, `CATEGORY_PERSONAL`, `CATEGORY_SOCIAL`, `CATEGORY_PROMOTIONS`, `CATEGORY_UPDATES` or `CATEGORY_FORUMS`. `TR…
| Parameter | Type | Description |
|---|---|---|
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
add_labels | array | The labels to add, 1 to 20: each a label's name or id, or a system id such as `INBOX`, `UNREAD` or `STARRED`. |
messages | array | The messages to change, 1 to 1000 `message_id`s. Give exactly one of this and `threads`. |
remove_labels | array | The labels to remove, 1 to 20: each a label's name or id, or a system id such as `INBOX`, `UNREAD` or `STARRED`. |
threads | array | The threads to change, 1 to 100 `thread_id`s. Give exactly one of this and `messages`. |
untrash | boolean | `true` first moves the messages or threads back out of the trash, then changes the labels. |
google_gmail_label_create Create Gmail label
Create a label in the account's Gmail, named `name` (1 to 225 characters, no space at either end; `/` nests it under another label, as Gmail does: `Work/Invoices`). A name already used by a label, ignoring case, is refused. `text_color` and `background_color` set its colors, both or neither, each a `#rrggbb` from Gmail's fixed palette (a refusal lists it); `show_in_list` and `show_in_messages` say whether it shows in the label list and on messages. Each call makes a new label; put it on mail with `google_gmail_label`. Returns the new `label_id` and its `name`. `account` is needed when several…
| Parameter | Type | Description |
|---|---|---|
name * | string | The new label's name, 1 to 225 characters with no space at either end; `/` nests it under another label, as Gmail does (`Work/Invoices`). |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
background_color | string | The label's background color as `#rrggbb`, from Gmail's palette; given together with `text_color`. |
show_in_list | boolean | Whether the label shows in the label list (default: Gmail's own default, shown). |
show_in_messages | boolean | Whether the label shows on messages in the message list (default: Gmail's own default, shown). |
text_color | string | The label's text color as `#rrggbb`, from Gmail's palette; given together with `background_color`. |
google_gmail_trash Trash Gmail
Move Gmail messages (`messages`, 1 to 100 `message_id`s) or threads (`threads`, 1 to 100 `thread_id`s) to the Trash, as `google_gmail_read` gives them; give exactly one of the two. One request each, in order. Gmail deletes what is in the Trash after 30 days, so this is destructive in time; it never deletes at once and deleting for good is not offered. To undo it, call `google_gmail_label` with `untrash: true`. The prompt lists the date, sender and subject of every message or thread and says when Gmail deletes it. Returns `trashed` (how many) and their `ids`; if one fails after earlier ones wer…
| Parameter | Type | Description |
|---|---|---|
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
messages | array | The messages to trash, 1 to 100 `message_id`s. Give exactly one of this and `threads`. |
threads | array | The threads to trash, 1 to 100 `thread_id`s. Give exactly one of this and `messages`. |
google_drive_read Read Drive
Read the account's Google Drive: My Drive, files shared with it and shared drives. method `search` returns up to `limit` files (default 20, at most 100) as `files`, newest change first (a full-text search is not sorted), each with `file_id`, `name`, `mime_type`, `kind` (`folder`, `google_doc`, `google_sheet`, `google_slides`, `google_drawing`, `google_other`, `shortcut` or `file`), `size` in bytes (none for Google's own files), `modified_time`, `created_time`, `parents`, `drive_id` (the shared drive it is in, else null), `owners`, `shared`, `trashed`, `web_view_link`, `starred`, `md5` and, for…
| Parameter | Type | Description |
|---|---|---|
method * | string | |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
drive_id | string | search: search only this shared drive, by the `drive_id` that method `drives` gave; left out, every drive. |
export_type | string | download: for a Google Docs, Sheets, Slides, Drawings or Apps Script file, the format to export, as a media type or one of `pdf`, `docx`, `xlsx`, `pptx`, `csv`, `tsv`, `txt`, `html`, `png`, `jpeg`, `s… |
file_id | string | file, download: the id a `search` result gave as `file_id`. |
folder | string | search: only files directly inside this folder: its id, or `root` for the top of My Drive. |
limit | integer | search, drives: how many to return (1 to 100; default 20 for search and 50 for drives). |
mime_type | string | search: only files of this media type (`application/pdf`; `application/vnd.google-apps.folder` finds folders). |
name | string | download: what to name the saved file, without its extension (which follows the content); left out, the file's own name. |
page_token | string | search, drives: the `next_page_token` of the previous call, for the next page. |
query | string | search: words to find in the names and contents of files (full text), taken as written; for exact conditions use `raw_query`. drives: a shared-drive query such as `name contains 'Design'`; left out, e… |
raw_query | string | search: a Drive query passed as written (`name contains 'budget' and modifiedTime > '2026-01-01T00:00:00'`), never with `query`; trashed files are then included unless `trashed` says otherwise. |
trashed | boolean | search: `true` finds only files in the trash, `false` only files outside it (default false). |
google_drive_upload Upload to Drive
Upload one file from this machine to the account's Google Drive, with Drive's resumable upload, streamed in pieces, up to 2 GiB. `path` is an absolute path and is read only inside the upload directories a person set up (the upload_dirs setting, empty by default; when none is set, tell the person to set one rather than look for another way to send the file); a link, a hard-linked file or a file outside them is refused. The file goes to My Drive (`folder` `root`, the default) or to a folder, by id, that is the account's own, not in the trash, not in a shared drive and shared with no one: a file…
| Parameter | Type | Description |
|---|---|---|
path * | string | The file to upload: an absolute path inside the upload directories a person set up (none by default). A link, a hard-linked file or a file outside them is refused. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
folder | string | The folder to put the file in: its id, or `root` for the top of My Drive (default). It must be the account's own and shared with no one, and not in a shared drive. |
mime_type | string | The file's media type (`application/pdf`); left out, taken from the file's extension, else `application/octet-stream`. Refused for a file under an encrypt_dirs directory, which goes up as `application… |
name | string | The name the file gets in Drive, 1 to 500 characters with no control character; left out, the file's own name. |
google_drive_folder_create Create Drive folder
Create one folder in the account's Google Drive, named `name` (1 to 500 characters, no control character). It goes into My Drive (`folder` `root`, the default) or into a folder, by id as `google_drive_read` gives it, that is the account's own, not in the trash, not in a shared drive and shared with no one: a folder made in a shared place is open to everyone who reaches it, and these tools never change sharing, so such a destination is refused. A folder or file of the same name is never replaced: this adds another, and the prompt says how many are there already. The account must hold the drive.…
| Parameter | Type | Description |
|---|---|---|
name * | string | The name of the new folder. 1 to 500 characters with no control character. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
folder | string | The folder to create it in: its id, or `root` for the top of My Drive (default). It must be the account's own and shared with no one, not in the trash and not in a shared drive. |
google_drive_copy Copy Drive file
Copy one file in the account's Google Drive, by `file_id` as `google_drive_read` gives it. Drive cannot copy a folder and a shortcut is not copied, so both are refused, and so is a file the account may not copy. The copy goes into My Drive (`folder` `root`, the default) or into a folder, by id, that is the account's own, not in the trash, not in a shared drive and shared with no one: a file put in a shared folder is shared with everyone who reaches it, and these tools never change sharing, so such a folder is refused. `name` (1 to 500 characters, no control character) names the copy; left out,…
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The id of the file to copy (not a folder or a shortcut), as `google_drive_read` gives it. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
folder | string | The folder to put the copy in: its id, or `root` for the top of My Drive (default). It must be the account's own and shared with no one, not in the trash and not in a shared drive. |
name | string | The name of the copy; left out, the copy keeps the file's name. 1 to 500 characters with no control character. |
google_drive_rename Rename Drive file
Give a file or folder in the account's Google Drive a new `name` (1 to 500 characters, no control character), by `file_id` as `google_drive_read` gives it. Only the name changes: not the content, the place or who can reach it. Renaming to the name it has already changes nothing more, and the old name is not kept, so to undo a rename call this again with the old name, which the prompt shows. The account must hold the drive.file scope to write and drive.readonly to read the item; drive.file lets these tools change only the files and folders they created or a person opened with them, so renaming…
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The id of the file or folder to rename, as `google_drive_read` gives it. |
name * | string | The new name. 1 to 500 characters with no control character. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
google_drive_move Move Drive file
Move one file or folder in the account's Google Drive to another folder, by `file_id` as `google_drive_read` gives it. Only its place changes: not its name, content or who can reach it. `folder` is the top of My Drive (`root`) or a folder, by id, that is the account's own, not in the trash, not in a shared drive and shared with no one: a file put in a shared folder is shared with everyone who reaches it, and these tools never change sharing, so such a folder is refused. An item in a shared drive, or in a shared folder, is refused too: moving it out would take it from the people who reach it th…
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The id of the file or folder to move, as `google_drive_read` gives it. |
folder * | string | The folder to move it to: its id, or `root` for the top of My Drive. It must be the account's own and shared with no one, not in the trash and not in a shared drive. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
google_drive_trash Trash Drive files
Move files or folders of the account's Google Drive to the trash (1 to 100 `file_ids`, as `google_drive_read` gives them). One request each, in order. Drive deletes what is in the trash after 30 days, so this is destructive in time; it never deletes at once and deleting for good is not offered. To undo it, call `google_drive_restore` with the same ids. Trashing a folder trashes what it holds, and trashing a file that is shared takes it away from the people it is shared with; the prompt says how many of the items others can reach. An item already in the trash is skipped, and the result lists it…
| Parameter | Type | Description |
|---|---|---|
file_ids * | array | The files and folders to move to the trash, 1 to 100 `file_id`s as `google_drive_read` gives them; each is changed once, in the order given. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
google_drive_restore Restore Drive files
Take files or folders of the account's Google Drive out of the trash (1 to 100 `file_ids`, as `google_drive_read` gives them: its search with `trashed: true` lists the trash). One request each, in order. This undoes `google_drive_trash`: each item comes back where it was, until Drive deletes it for good, 30 days after it was trashed. Restoring a folder restores what it held. An item that is not in the trash is skipped, and the result lists it under `skipped`; doing it again changes nothing more. The account must hold the drive.file scope to write and drive.readonly to read the items; drive.fil…
| Parameter | Type | Description |
|---|---|---|
file_ids * | array | The files and folders to restore from the trash, 1 to 100 `file_id`s as `google_drive_read` gives them; each is changed once, in the order given. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
google_comments_read Read comments
Read the comment threads of one Google Drive file, given as `file` (an id or a URL). Returns the file's `file_id`, `name`, `kind` and `web_view_link` and up to `limit` threads (default 50, at most 200) as `comments`, in Google's order, each with `comment_id`, `status` (`open` or `resolved`), `at`, `quote`, `author`, `me` (the account wrote it), `text`, `text_clipped`, `time`, `assignee` and `replies` (`reply_id`, `author`, `me`, `text`, `text_clipped`, `time`, `action` `resolve` or `reopen` when the reply resolved or reopened the thread, and `assignee`). Deleted comments and replies are left o…
| Parameter | Type | Description |
|---|---|---|
file * | string | The file's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…, https://docs.google.com/document/d/<id>/…, https://drive.google.com/file/d/<id>/…). |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
limit | integer | How many threads to return (1 to 200, default 50). |
ranges | array | Spreadsheets only: 1 to 100 A1 ranges (`Plan!B2:D4`, `'My tab'!A:C`); only the threads anchored inside them are returned. |
resolved | boolean | `true` also returns the resolved threads (default false). |
google_comments_add Add a comment
Add a comment to one Google Drive file, given as `file` (an id or a URL), or reply to a thread of it with `comment_id` (from `google_comments_read`). On a spreadsheet, a new comment is anchored to one cell, `cell` (`Plan!B2`, or `B2` for the first tab); give `cell` or `comment_id`, never both, and `assignee` (a plain address) to assign the thread, or, on a reply, to reassign a thread that is assigned already. On any other file the comment is not anchored and `cell` and `assignee` are refused; Google allows it only on a file these tools created or a person opened with them (drive.file), and oth…
| Parameter | Type | Description |
|---|---|---|
file * | string | The file's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…, https://docs.google.com/document/d/<id>/…, https://drive.google.com/file/d/<id>/…). |
text * | string | The comment's words, 1 to 2048 characters of plain text (at most 2048 bytes in UTF-8 on a spreadsheet). `+name@example.com` mentions that address, and Google emails it. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
assignee | string | Spreadsheets only: assigns the thread to this plain address, which Google emails. On a reply it reassigns a thread that is assigned already. |
cell | string | Spreadsheets only, for a new comment: the one cell to attach it to, in A1 notation (`Plan!B2`, or `B2` for the first tab). Never together with `comment_id`. |
comment_id | string | Replies to this thread instead of starting one: the `comment_id` of `google_comments_read`. Never together with `cell`. |
google_comments_status Resolve or reopen a comment
Resolve or reopen one comment thread of a Google Drive file, given as `file` (an id or a URL), with `comment_id` (from `google_comments_read`) and `status` (`resolved` or `open`). It sends the status alone, with no text, so nobody is emailed; to say something, use `google_comments_add`. A thread that has the status already is not touched, and the result says `changed: false`, so doing it again changes nothing. On spreadsheets and other Drive files alike it adds an empty-text reply with `action` `resolve` or `reopen`, which the thread then shows; on a file that is not a spreadsheet Google allow…
| Parameter | Type | Description |
|---|---|---|
comment_id * | string | The thread to change: the `comment_id` of `google_comments_read`. |
file * | string | The file's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…, https://docs.google.com/document/d/<id>/…, https://drive.google.com/file/d/<id>/…). |
status * | string | `resolved` resolves the thread, `open` reopens it. A thread that has this status already is not touched. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
google_comments_edit Edit a comment
Replace the text of one comment of a Google Drive file, given as `file` (an id or a URL), with `comment_id` (from `google_comments_read`), or of one reply to it with `reply_id` too. Only the account's own posts can be edited (`me` in `google_comments_read`); another author's is refused, and nothing is changed. `text` is plain text, 1 to 2048 characters (a spreadsheet's at most 2048 bytes in UTF-8). An edit emails nobody, so `text` may not mention an address the old text did not; to mention someone, add a reply with `google_comments_add`. On a spreadsheet it works on any thread; on any other fi…
| Parameter | Type | Description |
|---|---|---|
comment_id * | string | The thread: the `comment_id` of `google_comments_read`. |
file * | string | The file's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…, https://docs.google.com/document/d/<id>/…, https://drive.google.com/file/d/<id>/…). |
text * | string | The new words, replacing the old ones: 1 to 2048 characters of plain text (at most 2048 bytes in UTF-8 on a spreadsheet). It may not mention an address the old text did not. |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
reply_id | string | Edits this reply of the thread (the `reply_id` of `google_comments_read`). Left out, the comment's own text. |
google_comments_delete Delete a comment
Delete one comment thread of a Google Drive file, given as `file` (an id or a URL), with `comment_id` (from `google_comments_read`), or only one reply to it with `reply_id` too. Deleting a thread deletes every reply in it, other people's included; the prompt counts them. Google keeps no deleted comment, so this cannot be undone: the result returns the deleted text as `deleted_text`. Only the account's own posts can be deleted (`me` in `google_comments_read`; for a thread, its first comment); another author's is refused, and nothing is changed. On a spreadsheet, a reply that resolves or reopens…
| Parameter | Type | Description |
|---|---|---|
comment_id * | string | The thread: the `comment_id` of `google_comments_read`. |
file * | string | The file's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…, https://docs.google.com/document/d/<id>/…, https://drive.google.com/file/d/<id>/…). |
account | string | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. |
reply_id | string | Deletes only this reply of the thread (the `reply_id` of `google_comments_read`). Left out, the whole thread goes, with every reply in it. |