+ "content": "## Email attachments\n\n`Gmail.SendEmail`, `Gmail.WriteDraftEmail`, `Gmail.ReplyToEmail`, and `Gmail.WriteDraftReplyEmail` take an `attachments` parameter for local files. The agent emits only the file path; a client-side `preToolUse` hook swaps in the bytes before the request leaves your machine, so file contents never enter the model's context window.\n\nThe first time you attach a file, your agent installs the one-time hook for you after you approve. To set it up by hand, save the hook script (the one the tool returns in its setup response) to an absolute path and register it for your client:\n\n<Tabs items={[\"Cursor\", \"Claude Code\", \"Codex CLI\", \"VS Code chat\"]}>\n\n<Tabs.Tab>\n\nAdd to `~/.cursor/hooks.json`, merging the `preToolUse` entry. Cursor reloads on save.\n\n```json\n{\n \"version\": 1,\n \"hooks\": {\n \"preToolUse\": [\n { \"command\": \"python3 /abs/path/arcade_attachment_substitution.py --client cursor\", \"failClosed\": true, \"timeout\": 30 }\n ]\n }\n}\n```\n\n</Tabs.Tab>\n\n<Tabs.Tab>\n\nClaude Code v2.0.10+. Add to `~/.claude/settings.json`, merging the `PreToolUse` entry. Replace `<gmail_server>` with the name you registered the Arcade Gmail MCP server under (for `mcp__arcade__Gmail_SendEmail`, use `mcp__arcade__.*`).\n\n```json\n{\n \"hooks\": {\n \"PreToolUse\": [\n { \"matcher\": \"mcp__<gmail_server>__.*\", \"hooks\": [{ \"type\": \"command\", \"command\": \"python3 /abs/path/arcade_attachment_substitution.py --client claude-code\", \"timeout\": 30 }] }\n ]\n }\n}\n```\n\n</Tabs.Tab>\n\n<Tabs.Tab>\n\nCodex CLI v0.131+. Add to `~/.codex/hooks.json` (same shape as Claude Code), then trust the hook via `/hooks`.\n\n```json\n{\n \"hooks\": {\n \"PreToolUse\": [\n { \"matcher\": \"mcp__<gmail_server>__.*\", \"hooks\": [{ \"type\": \"command\", \"command\": \"python3 /abs/path/arcade_attachment_substitution.py --client codex\", \"timeout\": 30 }] }\n ]\n }\n}\n```\n\n</Tabs.Tab>\n\n<Tabs.Tab>\n\nVS Code 1.112+, in agent mode. Save a JSON file in `~/.copilot/hooks/`, then reload the window.\n\n```json\n{\n \"hooks\": {\n \"PreToolUse\": [\n { \"type\": \"command\", \"command\": \"python3 /abs/path/arcade_attachment_substitution.py --client vscode\", \"timeout\": 30 }\n ]\n }\n}\n```\n\n</Tabs.Tab>\n\n</Tabs>\n\nGmail caps total message size at 25 MB, and a `file://` URI belongs only in `source`.",
0 commit comments