{"slug": "show-hn-gml-a-gmail-cli-designed-for-agents", "title": "Show HN: Gml – A Gmail CLI designed for agents", "summary": "A new open-source command-line tool called Gml gives coding agents and shell workflows direct access to Gmail without a daemon, browser automation, or an SDK integration. Created by developer LongyiJdos, Gml returns compact text by default and structured JSON when needed, supporting search, read, send, reply, forward, draft, label, archive, star, spam, and trash operations with safe automation features like dry-run and explicit limits.", "body_md": "**Gmail, shaped for agents.**\n\n`gml`\n\ngives coding agents and shell workflows direct access to Gmail without a\ndaemon, browser automation, or an SDK integration. It returns compact,\ncommand-specific text by default and structured JSON when exact fields matter.\n\n**Agent-first output.** Stable table headers, bounded message bodies, useful summaries, and machine-readable errors.**One CLI for the full workflow.** Search, read, download, send, reply, forward, draft, label, archive, star, spam, and trash.**Safe automation.** Query-based writes require an explicit limit or`--all`\n\nand support`--dry-run`\n\nbefore anything changes.**Local OAuth.** Credentials stay on the machine, refresh automatically, and are never sent through an intermediary service.**Gmail-native.** Queries use Gmail search syntax, and`request`\n\nexposes the underlying Gmail API when a dedicated command is not enough.\n\n`gml`\n\nrequires [Node.js](https://nodejs.org/) 22.12 or later.\n\n```\nnpm install --global @longyijdos/gmail\ngml --version\n```\n\nCreate a Google OAuth **Desktop app** client, download its JSON file, then log\nin with read-only access:\n\n```\ngml auth login \\\n  --client-secret-file ~/Downloads/client_secret_....json \\\n  --scope readonly\n```\n\nFind the messages that matter and read only the one you select:\n\n```\ngml messages list \\\n  --q 'is:unread newer_than:7d' \\\n  --max-results 20 \\\n  --summary\n\ngml read MESSAGE_ID\n```\n\nUse JSON when another tool needs stable field access:\n\n```\ngml messages list --q 'from:alerts@example.com' --max-results 10 --json\n```\n\nNeed to organize or send mail? Reauthorize with `--scope modify`\n\n, then preview\nquery-based changes before applying them:\n\n```\ngml archive \\\n  --query 'older_than:30d label:newsletters' \\\n  --max-results 100 \\\n  --dry-run\n```\n\nSuccessful results go to stdout. Errors go to stderr with a nonzero exit code.\nGmail commands support `--json`\n\n; help and authentication stay readable text.\nLarge message bodies are truncated by default, list enrichment uses bounded\nconcurrency, and retryable API failures are identified explicitly.\n\n```\ngml help send\ngml auth status\ngml profile\ngml threads 'is:inbox newer_than:7d' --max-results 10 --summary\ngml send --to user@example.com --subject 'Status' --body-file report.txt\n```\n\n| Guide | Use it for |\n|---|---|\n|\n\n`gml`\n\nand creating Google OAuth client credentials[Agent skill](/longyijdos/gmail/blob/main/SKILL.md)`gml`\n\nsafely from an agent", "url": "https://wpnews.pro/news/show-hn-gml-a-gmail-cli-designed-for-agents", "canonical_source": "https://github.com/longyijdos/gmail", "published_at": "2026-07-22 09:28:46+00:00", "updated_at": "2026-07-22 09:52:30.741350+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents"], "entities": ["Gml", "Gmail", "LongyiJdos", "Node.js", "Google OAuth"], "alternates": {"html": "https://wpnews.pro/news/show-hn-gml-a-gmail-cli-designed-for-agents", "markdown": "https://wpnews.pro/news/show-hn-gml-a-gmail-cli-designed-for-agents.md", "text": "https://wpnews.pro/news/show-hn-gml-a-gmail-cli-designed-for-agents.txt", "jsonld": "https://wpnews.pro/news/show-hn-gml-a-gmail-cli-designed-for-agents.jsonld"}}