google-tools
# google-tools
Google tools for coding agents: Sheets, Gmail, Drive and Google Cloud.
| Harness | Delivery | Pinned by |
| -------------- | ---------------------------------------------- | ------------------------------ |
| OpenCode V2 | native plugin (npm package, with skills) | the version in the package |
| OpenCode V1 | native plugin (npm package, no skills) | the version in the package |
| Claude Code | plugin: MCP server and skills | the release tag, as the ref |
| Codex | plugin: MCP server and skills | the release tag, as the ref |
| Grok Build | plugin: MCP server and skills | the release tag, as `@ref` |
| Antigravity | plugin: MCP server and skills | the release tag's tree URL |
| Hermes Agent | native plugin (Python, calls the command line) | the release commit, as the SHA |
| other MCP host | MCP server from npm | the version in the package |
The tools need [Node.js](https://nodejs.org/) 24 or later.
[`docs/conventions.md`](docs/conventions.md) describes how the tools are named
and how they behave.
## Install
Install from a release, never from the default branch: a release is a tag whose
commit carries the built `dist/`, and the default branch does not. In the
commands below, `<version>` is a release's version (`1.2.3`) and `<sha>` is the
commit its tag names:
```sh
gh api repos/craft-agent/google-tools/commits/v<version> --jq .sha
```
### OpenCode
OpenCode V2 takes the package and its options in `opencode.json`:
```json
{
"plugins": [{ "package": "@craftsamo/google-tools@<version>", "options": { "read_only": false } }],
"permissions": [{ "action": "google_*", "resource": "*", "effect": "ask" }]
}
```
OpenCode V1 takes the package as a string, or as a pair with its options:
```json
{
"plugin": [["@craftsamo/google-tools@<version>", { "read_only": false }]],
"permission": { "google_*": "ask" }
}
```
OpenCode allows any action no rule names, so the plugin's request is granted
silently unless a rule says `ask`. Read tools never ask, so the `google_*` glob
is safe.
V1 registers no skills. Unpack the package and copy its `skills/*` folders into
`~/.config/opencode/skills/`:
```sh
npm pack @craftsamo/google-tools@<version>
tar -xzf craftsamo-google-tools-<version>.tgz
mkdir -p ~/.config/opencode/skills
cp -r package/skills/* ~/.config/opencode/skills/
rm -rf package craftsamo-google-tools-<version>.tgz
```
### Claude Code
```sh
claude plugin marketplace add craft-agent/plugins
claude plugin install google-tools@craft-agent
```
[craft-agent/plugins](https://github.com/craft-agent/plugins) lists every
craft-agent package at its latest release. To pin this package to a release
instead, add its own marketplace at the tag, and do not install it from both:
```sh
claude plugin marketplace add craft-agent/google-tools#v<version>
claude plugin install google-tools@google-tools
```
If you added this repository as the `craft-agent` marketplace before, remove
it first: `claude plugin marketplace remove craft-agent`.
### Codex
```sh
codex plugin marketplace add craft-agent/plugins
codex plugin add google-tools@craft-agent
```
[craft-agent/plugins](https://github.com/craft-agent/plugins) lists every
craft-agent package at its latest release. To pin this package to a release
instead, add its own marketplace at the tag, and do not install it from both:
```sh
codex plugin marketplace add craft-agent/google-tools --ref v<version>
codex plugin add google-tools@google-tools
```
If you added this repository as the `craft-agent` marketplace before, remove
it first: `codex plugin marketplace remove craft-agent`.
Codex turns `-` into `_` in server names, so it shows the tools as
`mcp__google_tools__google_*`. It starts the MCP server in the plugin's
install directory and passes no roots, so the server takes each call's directory
from what Codex sends with the call: its sandbox state, which the server asks
for, else the one workspace it names.
The plugin declares `default_tools_approval_mode = "writes"`: Codex asks before
every tool not marked read-only. A user's
`[plugins."<plugin>".mcp_servers.<server>]` setting can only tighten it. Setting
`auto` there yields `prompt` (reads asked too), since Codex treats `auto` and
`writes` as incomparable.
### Grok Build
```sh
grok plugin install craft-agent/google-tools@v<version> --trust
```
Grok starts the MCP server in the session's working directory.
### Antigravity
Install from the tree of the release tag, never from the default branch, which
has no built `dist/`; Antigravity clones the tag into
`~/.gemini/config/plugins/google-tools`.
```sh
agy plugin install https://github.com/craft-agent/google-tools/tree/v<version>
```
### Hermes Agent
Hermes installs a commit, not a tag, and the plugin installs disabled:
```sh
hermes plugins install craft-agent/google-tools --ref <sha>
hermes plugins enable google-tools
```
If a Hermes gateway is already running, restart it (`hermes gateway restart`) to
load the plugin.
The plugin runs the Node it found when Hermes started. If a version manager
removes that version while Hermes runs, a call looks for Node again; when it
finds none, restart Hermes from a shell where `node` runs.
When the package's writes depend on another Hermes plugin, such as a guard
that blocks writes no one is there to approve, name it in `require_plugins`.
Hermes keeps loading this plugin when that one fails to import or register,
and treats a manifest's `requires_plugins` as advisory. With the setting,
while a named plugin is not loaded, every write is refused before it is
approved, even under `--yolo`, `approvals.mode: off` or a remembered answer,
naming the plugin that is missing. Reads still run.
```yaml
plugins:
entries:
google-tools:
settings:
require_plugins: [write-guard]
```
### Any other MCP host
Add the server to the host's MCP configuration. Flags go in `args`:
```json
{
"mcpServers": {
"google-tools": {
"command": "npx",
"args": ["-y", "@craftsamo/google-tools@<version>", "--read-only"]
}
}
}
```
## Tools and skills
Each toolset comes with a skill that tells an agent how to use its tools. A
skill names its toolset under `metadata` in its frontmatter
(`metadata: { toolset: <name> }`, written as a block). OpenCode V2 and Hermes
register it only when the settings register at least one of that toolset's
tools, so a profile with the toolset off, or with all its tools removed, does
not see it; a skill without a toolset is always registered. Claude Code,
Codex, Grok Build and Antigravity install the skill folder whole and pass the
settings only to the MCP server, so they list every skill whatever the
settings select. OpenCode V1 registers no skills, and its copied skills are
all listed too.
### Account (`account`)
On by default. Shows which Google accounts are set up and what each can reach.
| Tool | What it does | Class |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| `google_account_read` | `list`: each account's credential source, address, scopes, toolsets and problem. `check`: refresh the token and ask Google whose account it is, against the address recorded | read |
`list` reads local state and never contacts Google. Neither method returns a
token, a client secret or a client id. When a credential needs a person, the
result carries the one command to run.
### Sheets (`sheets`)
On by default. Finds, reads and writes Google spreadsheets: their values,
formatting, structure and protections.
The `format` read also returns rich-text runs as `text` and styles, in
`transform`'s `rich_text` shape with a UTF-16 `start` index added. Only styled
text within a cell's first 2,000 characters is returned; `runs_clipped: true`
marks a run cut or dropped by that budget.
| Tool | What it does | Class |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `google_sheets_read` | `list`: spreadsheets by name. `view`: a spreadsheet's tabs. `values`: cells of A1 ranges. `snapshot`: a tab or block exported as a PDF and rendered to PNG files. `format`: cell formats and sizes. `structure`: merges, groups, tables, rules, filters, views, charts and protections (and pivots on request). `metadata`: developer metadata by key | read |
| `google_sheets_create` | create a spreadsheet, with named tabs if asked | add |
| `google_sheets_tab_add` | add a tab to a spreadsheet | add |
| `google_sheets_append` | add rows below a range's data, or to a native table | add |
| `google_sheets_edit` | overwrite the cells of A1 ranges | overwrite |
| `google_sheets_clear` | empty the values of A1 ranges | overwrite |
| `google_sheets_format` | cell formats, borders, sizes, hide, group, unmerge, freeze, tab colour, visibility, position and gridlines | idempotent change |
| `google_sheets_add` | insert rows and columns, duplicate a tab, add a table, conditional rule, validation, filter, filter view, chart, pivot or developer metadata | add |
| `google_sheets_restructure` | delete or move rows and columns, merge, delete or rename tabs, rename the spreadsheet, set its locale and time zone, change or delete tables, rules, validation, filters, views, charts, pivots and metadata | administrative |
| `google_sheets_transform` | sort, find and replace, copy, cut, dedupe, trim, split text, autofill, notes, rich text | administrative |
| `google_sheets_protect` | add, change or delete protected ranges | administrative |
The toolset asks for `spreadsheets.readonly` and `drive.metadata.readonly` to
read, and `spreadsheets` to write; `--read-only` leaves the write scope out.
`format`, `add`, `restructure`, `transform` and `protect` take a list of
`operations`, each an `op` from the tool's own vocabulary, sent as one
`spreadsheets.batchUpdate`, so all of them land or none does.
`edit`, `clear`, `restructure` and `transform` take `expect`: up to 200
cells and the values they must show now, or a cell and the developer-metadata
key (and value) its row must carry, so a row is found by its mark wherever
sorting moved it. If any differs the call writes nothing and fails as `stale`,
naming the cells. These four return `before`, the replaced cells, to give back
to `edit` as an undo. `protect` lists every editor each protection leaves.
Named ranges as ranges, slicers, banded ranges and data sources are not
offered.
### Gmail (`gmail`)
On by default. Finds and reads mail, sends it, keeps drafts, and keeps the
mailbox in order with labels and the trash.
| Tool | What it does | Class |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `google_gmail_read` | `search`: messages by Gmail query. `message`, `thread`: their text and attachment lists. `labels`: the labels. `drafts`, `draft`: drafts. `attachment`: save one attachment under the download directory | read |
| `google_gmail_send` | send a new mail or a reply, or an existing draft by `draft_id` | administrative |
| `google_gmail_draft_create` | keep a new mail as a draft | add |
| `google_gmail_draft_edit` | replace the whole message of a draft | overwrite |
| `google_gmail_draft_delete` | delete a draft for good | administrative |
| `google_gmail_label` | add and remove labels on messages or threads (archive, mark read, star), or take mail out of the trash | idempotent change |
| `google_gmail_label_create` | create a label, with colours if asked | add |
| `google_gmail_trash` | move messages or threads to the trash | overwrite |
The toolset asks for `gmail.readonly` to read, and `gmail.send`,
`gmail.compose` and `gmail.modify` to write; `--read-only` asks only for
`gmail.readonly`. Sending is administrative: it asks every time, and its
prompt names every recipient, blind copies included. A
[grant](#writes-no-one-is-there-to-approve) over `google_gmail_send` can bound
the number of recipients, whether a mail may go outside the account's own
domain, and whether it may carry attachments. Attachments are read only from
the directories of the `upload_dirs` [setting](#settings), empty by default, so
none can be attached until a person names one. Bodies are clipped (20,000
characters for a message, 60,000 for a thread) and the result says so.
Permanent deletion, filters, forwarding and mailbox settings are not offered.
### Drive (`drive`)
On by default. Finds, reads, downloads and exports files, shows who can reach
a file, uploads files from the machine, and keeps in order what the tools made:
folders, copies, names, places and the trash.
| Tool | What it does | Class |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------- |
| `google_drive_read` | `search`: files by words or a Drive query. `file`: one file with who can reach it. `drives`: the shared drives. `download`: save a file, or a Google file exported, under the download directory | read |
| `google_drive_upload` | upload one file from an upload directory to My Drive or a folder only the account reaches | add |
| `google_drive_folder_create` | create a folder | add |
| `google_drive_copy` | copy one file | add |
| `google_drive_rename` | give a file or folder a new name | idempotent change |
| `google_drive_move` | move a file or folder to another folder | idempotent change |
| `google_drive_trash` | move files or folders to the trash | overwrite |
| `google_drive_restore` | take files or folders out of the trash | idempotent change |
The toolset asks for `drive.readonly` to read and `drive.file` to write;
`--read-only` asks only for `drive.readonly`. `drive.file` reaches only the
files and folders these tools created, or a person opened with them: Google
refuses a write to any other, and the tool reports it as `forbidden`.
Nothing is put into or taken out of a shared place: the destination of an
upload, a new folder, a copy or a move must be a folder the account owns and
no one else reaches (not in a shared drive, no permission beyond the owner's),
since an item put in a folder takes its permissions, and an item in a shared
folder or shared drive is not moved out. Uploads are read only from the
directories of the `upload_dirs` [setting](#settings), empty by default.
A file under a directory of `encrypt_dirs` goes up only encrypted with
[age](https://github.com/FiloSottile/age) to the public keys of
`age_recipients` (age must be installed), named `.age`; the package holds no
secret key and never decrypts. Downloads are saved up to 2 GiB; a Google
Docs, Sheets, Slides, Drawings or Apps Script file is exported (Google exports
up to 10 MB, and not Vids). Trashed items are deleted by Drive after 30 days;
`google_drive_restore` undoes it. Changing who can reach a file, deleting for
good, revisions and managing shared drives are not offered.
### Comments (`comments`)
On by default. Reads the comment threads of a spreadsheet or another Drive
file, adds comments and replies, resolves and reopens threads, and edits and
deletes the account's own comments.
| Tool | What it does | Class |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ----------------- |
| `google_comments_read` | the comment threads of one file with their replies; in a spreadsheet, the cell of each, and `ranges` limits them to some | read |
| `google_comments_add` | add a comment, or a reply to a thread; in a spreadsheet on one cell, and a thread may be assigned | administrative |
| `google_comments_status` | resolve or reopen a thread | idempotent change |
| `google_comments_edit` | replace the text of the account's own comment or reply | overwrite |
| `google_comments_delete` | delete the account's own comment with every reply in it, or one reply | administrative |
The toolset asks for `spreadsheets.readonly` and `drive.readonly` to read and
`spreadsheets` and `drive.file` to write; `--read-only` leaves the write scopes
out. A spreadsheet's comments are its own, anchored to one cell. On any other
file a comment is not anchored, and `drive.file` reaches only the files these
tools created or a person opened with them: Google refuses a write to any
other, and the tool reports it as `forbidden`. Adding is administrative: an
assignee and every address a text mentions (`+name@example.com`) is emailed by
Google, mail cannot be taken back, and the prompt lists them first. An edit
that would mention a new address is refused, so an edit emails nobody. Google
keeps no deleted comment, and a deleted thread takes its replies with it. Only
the account's own comments are edited or deleted. A spreadsheet's change counts
only when Google reports it saved; otherwise the tool says it may or may not
have been made. Comments on files these tools did not create, anchoring a
comment outside a spreadsheet and assigning one there are not offered.
### Cloud Run (`run`)
Off by default. Reads a project's Cloud Run services and jobs, deploys them
from the project's own images, splits traffic, runs and cancels jobs, and
deletes revisions, services and jobs.
| Tool | What it does | Class |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
| `google_run_read` | `services`, `service`: services with their traffic and settings. `revisions`, `revision`. `jobs`, `job`, `executions`, `execution`, `tasks`: jobs and their runs. `iam`: a service's or job's policy. `operation`: a change | read |
| `google_run_service_deploy` | deploy an image to a service, creating it when there is none | overwrite |
| `google_run_traffic_set` | replace a service's traffic split between its revisions and the latest, with tags | overwrite |
| `google_run_job_deploy` | deploy an image to a job, creating it when there is none | overwrite |
| `google_run_job_run` | start an execution of a job, with overrides of plain variables, args, task count and timeout for that run | add |
| `google_run_execution_cancel` | cancel an execution that is still running | overwrite |
| `google_run_revision_delete` | delete a revision that no traffic or tag reaches | administrative |
| `google_run_service_delete` | delete a service with every revision | administrative |
| `google_run_job_delete` | delete a job with its executions | administrative |
The toolset asks for `run.readonly` to read and `run` to write; `--read-only`
asks only for `run.readonly`, and `cloud-platform` is never asked. Every call
names its `project` and `region`, with no default. An image must sit in the
project's own Artifact Registry or Container Registry; any other is refused
before anyone is asked, and a
[grant](#writes-no-one-is-there-to-approve) over a deploy can bound the
image's repository path (`image`, a `prefix` such as
`asia-northeast1-docker.pkg.dev/my-proj/apps/api`). A deploy changes only the
image and the settings its arguments name, on one container, and sends the
rest of the service or job back as Google gave it; a new one takes Google's
defaults, so invoking a service needs IAM. Environment values are never
returned or shown: variables come back by name and kind, and one that
references a secret is never set, removed or overridden. Writes wait up to two
minutes for Google's operation and return it when it is still running; a job
run returns once the execution has started. A revision that traffic or a tag
still reaches is not deleted. Changing IAM or public access, the service
account, ingress, network, secrets and volumes, building from source and
deleting an execution are not offered.
`revisions` and `revision` return images already resolved to digests:
`images[].image` and `digest` are the same `…@sha256:…` reference, not the tag
deployed. A project that does not exist or whose Cloud Run Admin API is off
is `forbidden`; a region that does not exist is `upstream_error`, with
Google's reason (such as `Unsupported region …`) in the message. `not_found`
means a service, job, revision, execution or operation does not exist.
### Grants (`grants`)
Off by default. Delegates bounded writes for jobs where no person can answer.
| Tool | What it does | Class |
| --------------------- | -------------------------------------------------------- | -------------- |
| `google_grant_create` | ask a person to delegate one tool's writes within limits | administrative |
| `google_grant_read` | list grants and their use, or read the usage log | read |
| `google_grant_revoke` | remove a grant so no more calls run under it | overwrite |
Every write tool can be granted for its targets, calls per hour and expiry.
A tool adds what a grant can also limit by declaring `bounds` and giving
`measure(args, context)` in its spec: a ceiling (`max`), a yes or no
(`allow`), values from a list (`oneOf`) or the paths a value must sit under
(`prefix`); see the
[conventions](docs/conventions.md#writes-no-one-is-there-to-approve).
## Google accounts
The tools call Google's APIs as you, through an OAuth client you create in a
Google Cloud project of your own; the package ships none.
1. In the [Google Cloud console](https://console.cloud.google.com/), create a
project or pick one, and enable the API of each toolset you will use
(APIs & Services → Library: Google Sheets API, Gmail API, Google Drive
API, Cloud Run Admin API and so on).
2. Open Google Auth Platform. Under **Branding**, give the app a name and your
address. Under **Audience**, choose **External** for a personal account
(**Internal** for a Workspace organization's own users) and, for External,
press **Publish app** so its status is **In production**. A client left in
**Testing** gets refresh tokens that stop working 7 days after you log in.
3. Under **Clients**, create a client of type **Desktop app** and download
its JSON file.
Your own use, or that of fewer than 100 people you know, needs no
verification by Google, even for the restricted scopes of Gmail and Drive.
Logging in then shows a "Google hasn't verified this app" screen; choose
**Advanced** and continue to your app.
A label names one Google account, `default` unless you name another; a call
picks one with its `account` argument, which may be left out while there is
only one. The package's `login` command takes the client's JSON file, the
label and the toolsets the label is for, opens your browser, and asks Google
only for the scopes of those toolsets (`--read-only`: only their read
scopes), plus your address (`openid` and `email`), which the label records.
To add a toolset to a label later, log in again with the whole list;
Desktop clients cannot add scopes to a consent. One label may hold Workspace
and Cloud scopes together, but a label per use (one for mail and files, one
for Cloud) keeps a leaked token from reaching both. Labels logged in with
the same client for the same account still share one grant at Google:
revoking any of their tokens logs all of them out. `remove` deletes a
label's state and revokes its token at Google, unless another label shares
the grant; then the token stays valid until the last of those labels is
removed, and `remove --revoke` revokes it anyway and logs them out too.
Each label keeps its state in its own directory,
`<state root>/accounts/<label>/` (mode 700), under the `state_dir`
[setting](#settings): by default `$XDG_STATE_HOME/google-tools`, else
`~/.local/state/google-tools`. A label's credential is one JSON object (the
refresh token, the OAuth client it belongs to, the granted scopes and the
account's address). It comes from `GOOGLE_TOOLS_CREDENTIALS_<LABEL>`
(`GOOGLE_TOOLS_CREDENTIALS_DEFAULT` for `default`) when that is set, else
from `credentials.json` (mode 600), which `login` writes in the label's
directory; to keep it in a keychain instead, store that file's content in the
variable and delete the file. Never pass a token as an argument. Codex
forwards no variable whose name depends on a label, so use the file there.
## Adding a tool
1. Write the spec in `src/core/<domain>/<verb>.ts` with `defineTool`: an ID
`<prefix>_<domain>_<verb>`, a title and description, the Zod argument and
output schemas, its toolset and write class, and `execute(args, context)`.
A write tool also gives `targets(args, context)`: what the call writes to,
as a permission rule should name it. A tool whose settings can put some
calls out of reach whatever the person answers gives
`gate(args, context)`, which throws for such a call; it is refused before
anyone is asked, and before `execute`.
2. Test it beside the spec (`<verb>.test.ts`), calling it through `invoke` as
the entry points do. A tool that runs a program is tested against a fake of
that program on `PATH`; no test reaches a real service.
3. List it in `src/tools.ts`. A new toolset goes into `toolsets` in
`src/project.ts` (and `defaultToolsets` when it is on by default), a
setting of the package's own into `options` (and `OPTIONS` in `project.py`
with `config_schema` in `plugin.yaml`), and a variable the tool reads
besides the settings into `toolVariables`.
4. Add or update the toolset's skill, `skills/<prefix>-<toolset>/SKILL.md`,
whose frontmatter names the toolset under `metadata`.
5. Run `pnpm run build && pnpm run manifests` to list the tool in
`plugin.yaml` and its variables in Codex's manifest, then describe it under
"Tools and skills".
[`docs/conventions.md`](docs/conventions.md) has the rules each step follows.
A package declares each option as `text`, `boolean`, `number`, `list`, `path`
or `paths`, or as an object with `type` and optional bounds. For example, in
`src/project.ts`:
```ts
options: {
notes_dir: "path",
note_limit: { type: "number", integer: true, min: 1, max: 50 },
}
```
`integer: true` requires a whole number; `min` and `max` bound a number or
count a `list` or `paths` value's items. An object with only `type` means the
same as the type alone. Hermes's `OPTIONS` mirrors the declarations on one
line, with double quotes and Python's `True` for `integer`:
```python
OPTIONS: dict[str, str | dict[str, object]] = {"notes_dir": "path", "note_limit": {"type": "number", "integer": True, "min": 1, "max": 50}}
```
## Reads and writes
Every read tool is named `<prefix>_<domain>_read`. Reads can run unasked;
writes are confirmed by the harness.
| Harness | Reads without asking |
| ----------- | ------------------------------------------------------------------------------------------------------------ |
| OpenCode | always; the plugin asks only before a write |
| Claude Code | the rule `mcp__plugin_google-tools_google-tools__*_read` in `permissions.allow` of `~/.claude/settings.json` |
| Codex | always; Codex runs tools that declare `readOnlyHint` unasked, as the read tools do |
| Grok Build | `grok --allow 'MCPTool(google-tools__*_read)' --allow 'MCPTool(google_*_read)'` (both rules; see below) |
| Antigravity | the rule `mcp(google-tools_google-tools/<tool id>)` in `permissions.allow`, one for each read tool |
| Hermes | always; the plugin asks only before a write |
Where a write is asked about, and where it is not:
- **OpenCode** grants any action no rule names, so a write runs unasked unless
a rule asks for it: add the `google_*` rule shown under [OpenCode](#opencode).
- **Codex** asks before every write because of the plugin's approval mode.
Under `codex exec` it refuses with "MCP tool call requires approval, but
approval policy is never". For bounded jobs, see
[Writes no one is there to approve](#writes-no-one-is-there-to-approve).
- **Grok Build** under `grok -p` refuses a write it cannot ask about, unless it
is allowed beforehand.
- **Grok Build** calls the plugin's tools through its `use_tool` tool, and the
agent often names a tool without its server first. Grok checks the rules
against the name as given, so the server-qualified rule alone does not match
that first call. The second rule matches the short name; a write still
matches neither.
- **Antigravity** asks before any MCP tool no rule allows, reads included, and
names the plugin's server `google-tools_google-tools` (plugin,
then server). `agy -p` refuses a tool it cannot ask about.
- **Hermes** `hermes chat -q` refuses a write it cannot ask about; `hermes -z`
and `--yolo` skip approval, so writes then run unasked. For bounded jobs, see
[Writes no one is there to approve](#writes-no-one-is-there-to-approve).
A call a tool's `gate` refuses never runs, whatever the answer. OpenCode and
Hermes refuse it before they ask, so no prompt shows it; Hermes blocks it with
the tool's error. Claude Code, Codex, Grok Build and Antigravity draw their
own prompt before the MCP server sees the call, so they may still ask about
it; the server then refuses it.
## Writes no one is there to approve
A grant limits a job's writes to one tool, for at most 90 days. The person
decides the rest: the targets (named ones, or `*` for any), the bounds the
tool declares (one left out is no limit) and the calls per hour (left out,
any number). Every call made under a grant is logged. A grant never
overrides the host's permissions. The
[conventions](docs/conventions.md#writes-no-one-is-there-to-approve) give the
contract.
1. In a session where a person answers, supply the key described under
[Settings](#settings), turn on the `grants` toolset alongside the job's
toolset, and ask the agent to delegate. It calls `google_grant_create`;
the prompt shows the tool, targets, rate, days, every bound the tool
declares (`no limit` for one left out) and the reason.
Approve once.
2. Set the same key and `unattended` for the job only, for example
`GOOGLE_TOOLS_UNATTENDED=true`. Otherwise grants are not checked.
3. Let the host allow the write tool in that run, as below. The grant still
bounds each call.
4. Revoke with `google_grant_revoke`, or list grants and their use with
`google_grant_read`.
What lets a write reach the package when no one can answer:
- **OpenCode** `opencode run` rejects every question unless an allow rule
names the tool (`"permission": { "google_note_create": "allow" }`) or the
run starts with `--auto`.
- **Claude Code** `claude -p` needs the tool in `--allowedTools`, as
`mcp__plugin_google-tools_google-tools__google_note_create`.
- **Codex** `codex exec` needs `approval_mode = "approve"` for that tool under
the plugin's MCP server in `config.toml`
(`[mcp_servers.<server>.tools.<tool>]`), since the plugin's default asks
before every write.
- **Grok Build** `grok -p` needs both allow rules:
`--allow 'MCPTool(google-tools__google_note_create)'` and
`--allow 'MCPTool(google_note_create)'`, for the qualified and short names
described under [Reads and writes](#reads-and-writes).
- **Antigravity** `agy -p` needs
`mcp(google-tools_google-tools/google_note_create)` in
`permissions.allow`.
- **Hermes** `hermes chat -q` denies by `approvals.single_query_mode` unless
allowed. `-z` and `--yolo` skip approvals and run the write; the grant is
then the only bound.
### Limits
- A run with every approval skipped (Hermes `-z` or `--yolo`, an
always-approve mode, an explicit `allow` for `google_grant_create`, or a
global OpenCode V1 `allow`) shows no prompt. A grant created there is not a
person's answer, and it can be as wide as any target, no bound and no rate
for 90 days: create grants only where the harness asks.
- An earlier copy of the grants directory put back whole is not detected.
Expiry, at most 90 days, bounds what it can restore.
- Anyone who can read the key can sign grants. Keep it where the agent's
tools cannot read it.
- The OpenCode V2 plugin forces a question for `google_grant_create`
through a hook; only hosts that offer that hook run it.
The OpenCode V2 service and Hermes gateway keep the environment they started
with; see [Settings](#settings) before changing the job's variables.
## Settings
Every entry point takes the same settings. A flag wins over its environment
variable, and an option or setting wins over the variable too.
| Setting | Flag | Variable | Meaning |
| ----------------- | ------------------ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `toolsets` | `--toolsets` | `GOOGLE_TOOLS_TOOLSETS` | the toolsets that are on, or `all`; default those `src/project.ts` names |
| `read_only` | `--read-only` | `GOOGLE_TOOLS_READ_ONLY` | registers no tool that writes; wins over every other setting |
| `unattended` | `--unattended` | `GOOGLE_TOOLS_UNATTENDED` | no person can answer: a write runs only under a grant that covers it; off by default |
| `grants_dir` | `--grants-dir` | `GOOGLE_TOOLS_GRANTS_DIR` | where grants and their use are kept; default `$XDG_STATE_HOME/google-tools/grants`, else `~/.local/state/google-tools/grants` |
| `state_dir` | `--state-dir` | `GOOGLE_TOOLS_STATE_DIR` | where each label keeps its credential and lock; default `$XDG_STATE_HOME/google-tools`, else `~/.local/state/google-tools` |
| `download_dir` | `--download-dir` | `GOOGLE_TOOLS_DOWNLOAD_DIR` | where tools write files they download or export, such as sheet snapshots; default `~/Downloads/google-tools`. Never inside the state directory or the tools' install directory, never through a link, never over an existing file |
| `upload_dirs` | `--upload-dirs` | `GOOGLE_TOOLS_UPLOAD_DIRS` | directories tools may attach files from, such as a mail's attachments; empty by default, so no file is read. A file must lie inside one by real path, be a regular file with one link, and be outside the state and install directories |
| `encrypt_dirs` | `--encrypt-dirs` | `GOOGLE_TOOLS_ENCRYPT_DIRS` | directories whose files go up only encrypted with age, such as to Drive; empty by default. A file there must also lie in an `upload_dirs` directory, since this widens nothing; matching ignores case |
| `age_recipients` | `--age-recipients` | `GOOGLE_TOOLS_AGE_RECIPIENTS` | the age public keys (`age1…`) that files under `encrypt_dirs` are encrypted to; needs age installed. The package holds no secret key and never decrypts |
| `tools` | `--tools` | `GOOGLE_TOOLS_TOOLS` | single tools to add by ID, whatever their toolset |
| `exclude_tools` | `--exclude-tools` | `GOOGLE_TOOLS_EXCLUDE_TOOLS` | single tools to remove by ID; wins over `tools` and `toolsets` |
| `confirm` | `--confirm` | `GOOGLE_TOOLS_CONFIRM` | MCP server only: `harness` (default) or `elicitation`, as the conventions say |
| `language` | `--language` | `GOOGLE_TOOLS_LANGUAGE` | native plugins only: the approval prompt's language, such as `ja` |
| `emoji` | — | — | Hermes only: the emoji shown beside each toolset, by toolset name (`""` for none) |
| `require_plugins` | — | — | Hermes only: the plugins that must be loaded; while one is not, every write is refused before it is approved |
`GOOGLE_TOOLS_GRANT_KEY` is a variable only, never a flag or a plugin
option. Use at least 32 characters, for example from `openssl rand -hex 32`,
stored where the host keeps secrets. Without it no write runs while
unattended and no grant can be created. Codex forwards it alongside the
settings' variables, as described below.
Lists are comma-separated in a flag or a variable. A package's own settings,
listed in `options` in `src/project.ts`, take a row each here and are read the
same way. A `path` is trimmed; `~` and `~/…` (also with the platform separator)
stand for the home directory (`HOME` when it is absolute, else the account's).
It must then be absolute and reaches the tool normalized,
without a filesystem check. `paths` is a list of such paths, comma-separated
in a flag or variable and an array of strings in a plugin option. Blank paths
and lists with no items after trimming and dropping blanks count as unset.
Bounds check only a given value, not an unset option. Refused values are
`invalid_argument`, naming the flag, variable or option and what it must be.
Hermes passes paths and lists to the command line, which checks the paths and
bounds. Where each harness reads them:
- **OpenCode** takes the plugin `options` shown above, with lists as arrays and
`read_only` as a boolean, and falls back to the variables. V2 runs plugins in
its background service, which keeps the environment it started with: a
variable set where `opencode run` starts has no effect until the service is
restarted in that environment (`opencode service restart`). V1 runs plugins
in its own process.
- **Hermes** takes `plugins.entries.google-tools.settings` in
`config.yaml`:
```yaml
plugins:
entries:
google-tools:
settings:
read_only: false
exclude_tools: []
```
Without a `language` setting, the approval card follows Hermes's own
`display.language` (or `HERMES_LANGUAGE`), the language of its approval
buttons, and else stays in English. The plugin passes its own environment
to the command line it runs, so the variables work too. A running gateway keeps the environment it started with;
restart it (`hermes gateway restart`) after changing one.
- **Claude Code, Grok Build and Antigravity** start the plugin's server without
flags and pass it the client's environment, so set the variables in the
environment the harness runs in.
- **Codex** passes a plugin's MCP server only a few basic variables (such as
`PATH` and `HOME`) and those the plugin's manifest names, which are the
variables above: set them in the environment Codex runs in. A variable the
tools read besides the settings belongs in `toolVariables` in
`src/project.ts`; `pnpm run manifests` adds it to the manifest after the
settings' variables. To pass flags, or to give the server a variable the
package does not name, add the server under `[mcp_servers]` in Codex's
`config.toml` instead of using the plugin: flags go in `args`, `env_vars`
names the variables to forward from Codex's environment, and `env` sets
fixed values.
```toml
[mcp_servers.google-tools]
command = "npx"
args = ["-y", "@craftsamo/google-tools@<version>", "--read-only"]
env_vars = ["GOOGLE_TOOLS_TOOLSETS"]
```
## Layout
- `src/project.ts` — the package's name, tool ID prefix, setting prefix,
toolsets, tool options and the other variables its tools read.
- `src/core/` — the tool contract and the tools, free of any harness and of
the project's names.
- `src/tools.ts` — the list of every tool, which each entry point registers.
- `src/words.ts` — the translations of the tools' words, per language, which
the native plugins use in their approval prompts.
- `src/mcp/` — the MCP server, built to `dist/mcp.js` and run by
`google-tools`.
- `src/opencode/` — the OpenCode plugin, built to `dist/opencode.js`.
- `src/cli/` — the command line the Hermes plugin calls, built to `dist/cli.js`
and run by `google-tools-cli`.
- `src/hermes/`, `plugin.yaml` and `__init__.py` — the Hermes plugin.
- `skills/` — one skill per toolset, `skills/<name>/SKILL.md`, which every
harness that takes skills loads from the package or plugin root; the native
plugins load only those of the toolsets that are on.
- `.claude-plugin/`, `.codex-plugin/`, `.agents/plugins/`, `.mcp.json`,
`.antigravity-plugin/` and `mcp_config.json` — the plugin manifests of the
other harnesses. Codex reads `.codex-plugin/plugin.json`; a root
`plugin.json` would make it load the plugin as an Agent Plugin, whose tool
budget hides tools past a fixed size. The root `.mcp.json` is the
configuration Grok Build reads (with `${CLAUDE_PLUGIN_ROOT}`, the variable
both Grok Build and Claude Code expand); when working on this repository in
Claude Code, decline the project MCP server it offers from that file.
How a release is made is in [`RELEASING.md`](RELEASING.md).
## License
[AGPL-3.0 with Commons Clause](LICENSE)
TDQS
Scored across 33 tools
Service prefixes (google_sheets_, google_drive_, google_gmail_, google_comments_) plus per-tool descriptions that explicitly cross-reference each other make most tools easy to tell apart. The main soft spots are within Sheets: append vs add vs edit vs transform vs restructure overlap conceptually (all mutate sheet data), and tab_add vs add's tab_duplicate, though the descriptions spell out the boundaries.
All tools use snake_case with a consistent service_object_verb pattern (google_sheets_format, google_gmail_draft_create, google_comments_status). Minor deviations: a few generic names (google_sheets_add, google_sheets_transform, google_sheets_restructure) and tab_add places the noun before the verb, but nothing that confuses the overall scheme.
33 tools is high against the generic 25+ threshold, but it's genuinely a four-service server (Sheets, Drive, Gmail, Comments plus account) at roughly 8 tools per service, which is defensible. Sheets accounts for 11 tools, which is somewhat heavy but each maps to a distinct lifecycle operation.
Coverage is broad and mostly complete: full Sheets read/mutate/format/structure/protect, Drive upload/copy/move/rename/trash/restore/folder-create, Gmail read/send/draft/label/trash, and full comment CRUD with status. Gaps are minor and typical (no Gmail label delete, no Drive sharing/permission management, no permanent delete), which agents can work around or are intentionally excluded.