mcpField
G
gog

gog

github.com/letta-ai生产力152117 次安装4 周前更新
代码仓库

关于 gog

这项 Skill 指导使用 `gog` 命令行操作 Gmail、Calendar、Drive、Contacts、Sheets 和 Docs,可处理邮件与日历任务,并搜索或编辑受支持的 Google 数据;需要配置 OAuth。

主要功能

  1. 01搜索和发送 Gmail 邮件
  2. 02创建草稿和回复
  3. 03列出并管理日历活动
  4. 04搜索 Drive 并列出联系人
  5. 05读取和更新 Sheets 数据
  6. 06导出和读取 Docs

适用场景

  1. 01查找近期或匹配条件的邮件
  2. 02起草或发送邮件
  3. 03安排或更新日历活动
  4. 04搜索文件或更新电子表格单元格

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/letta-ai/skills --skill gog

安装后在 Claude Code 中输入/gog确认已加载。

附带文件assets/gog-small.svgLICENSE

详细介绍

gog

使用 gog 处理 Gmail/Calendar/Drive/Contacts/Sheets/Docs。需要完成 OAuth 设置。

设置(仅需一次)

  • gog auth credentials /path/to/client_secret.json
  • gog auth add [email protected] --services gmail,calendar,drive,contacts,docs,sheets
  • gog auth list

常用命令

  • Gmail 搜索:gog gmail search 'newer_than:7d' --max 10
  • Gmail 邮件搜索(按单封邮件搜索,不考虑会话):gog gmail messages search "in:inbox from:ryanair.com" --max 20 --account [email protected]
  • Gmail 发送(纯文本):gog gmail send --to [email protected] --subject "Hi" --body "Hello"
  • Gmail 发送(多行):gog gmail send --to [email protected] --subject "Hi" --body-file ./message.txt
  • Gmail 发送(标准输入):gog gmail send --to [email protected] --subject "Hi" --body-file -
  • Gmail 发送(HTML):gog gmail send --to [email protected] --subject "Hi" --body-html "<p>Hello</p>"
  • Gmail 草稿:gog gmail drafts create --to [email protected] --subject "Hi" --body-file ./message.txt
  • Gmail 发送草稿:gog gmail drafts send <draftId>
  • Gmail 回复:gog gmail send --to [email protected] --subject "Re: Hi" --body "Reply" --reply-to-message-id <msgId>
  • Calendar 列出活动:gog calendar events <calendarId> --from <iso> --to <iso>
  • Calendar 创建活动:gog calendar create <calendarId> --summary "Title" --from <iso> --to <iso>
  • Calendar 创建活动并设置颜色:gog calendar create <calendarId> --summary "Title" --from <iso> --to <iso> --event-color 7
  • Calendar 更新活动:gog calendar update <calendarId> <eventId> --summary "New Title" --event-color 4
  • Calendar 显示颜色:gog calendar colors
  • Drive 搜索:gog drive search "query" --max 10
  • Contacts:gog contacts list --max 20
  • Sheets 获取:gog sheets get <sheetId> "Tab!A1:D10" --json
  • Sheets 更新:gog sheets update <sheetId> "Tab!A1:B2" --values-json '[["A","B"],["1","2"]]' --input USER_ENTERED
  • Sheets 追加:gog sheets append <sheetId> "Tab!A:C" --values-json '[["x","y","z"]]' --insert INSERT_ROWS
  • Sheets 清除:gog sheets clear <sheetId> "Tab!A2:Z"
  • Sheets 元数据:gog sheets metadata <sheetId> --json
  • Docs 导出:gog docs export <docId> --format txt --out /tmp/doc.txt
  • Docs 输出内容:gog docs cat <docId>

Calendar 颜色

  • 使用 gog calendar colors 查看所有可用的活动颜色(ID 1-11)
  • 使用 --event-color <id> 标志为活动添加颜色
  • 活动颜色 ID(来自 gog calendar colors 的输出):
    • 1:#a4bdfc
    • 2:#7ae7bf
    • 3:#dbadff
    • 4:#ff887c
    • 5:#fbd75b
    • 6:#ffb878
    • 7:#46d6db
    • 8:#e1e1e1
    • 9:#5484ed
    • 10:#51b749
    • 11:#dc2127

电子邮件格式

  • 优先使用纯文本。多段消息请使用 --body-file(标准输入则使用 --body-file -)。

  • 草稿和回复也可使用相同的 --body-file 模式。

  • --body 不会对 \n 进行反转义。如果需要在行内换行,请使用 heredoc 或 $'Line 1\n\nLine 2'。

  • 仅在需要丰富格式时使用 --body-html。

  • HTML 标签:段落使用 <p>,换行使用 <br>,粗体使用 <strong>,斜体使用 <em>,链接使用 <a href="url">,列表使用 <ul>/<li>。

  • 示例(通过标准输入传入纯文本):

    gog gmail send --to [email protected] \
      --subject "Meeting Follow-up" \
      --body-file - <<'EOF'
    Hi Name,
    
    Thanks for meeting today. Next steps:
    - Item one
    - Item two
    
    Best regards,
    Your Name
    EOF
    
  • 示例(HTML 列表):

    gog gmail send --to [email protected] \
      --subject "Meeting Follow-up" \
      --body-html "<p>Hi Name,</p><p>Thanks for meeting today. Here are the next steps:</p><ul><li>Item one</li><li>Item two</li></ul><p>Best regards,<br>Your Name</p>"
    

注意事项

  • 设置 [email protected],即可避免重复指定 --account。
  • 编写脚本时,优先使用 --json 和 --no-input。
  • Sheets 的值可通过 --values-json(推荐)或内联行传入。
  • Docs 支持导出、输出内容和复制。就地编辑需要 Docs API 客户端(gog 不提供)。
  • 发送邮件或创建活动前请先确认。
  • gog gmail search 每个会话返回一行;需要分别返回每封邮件时,请使用 gog gmail messages search。

评论

支持 Markdown