Jack Wotherspoon · 2025-01-01

使用 Gemini CLI 扩展进行自定义

摘要

本课程介绍 Gemini CLI 扩展如何通过将 MCP 服务器与自定义命令和上下文文件捆绑在一起,实现复杂工作流自动化。讲师演示了如何使用 Google Workspace 扩展从 Google Doc 读取会议日程并自动在日历中创建预留时间,展示了扩展系统强大的集成能力。

要点

  • Gemini CLI 扩展超越了基础 MCP 服务器,允许将多个服务器打包为易安装的单元,包含自定义上下文文件和斜杠命令
  • 扩展生态系统包含超过 200 个扩展,覆盖 monday.com、Google Workspace 等常用工具,每个扩展都提供特定的工作流优化
  • 通过自定义上下文文件,可以指导 Gemini 如何正确使用工具,实现跨文档、日历和表格等应用的复杂协调操作
  • 实践演示展示了从 Google Doc 读取 TechStack 会议日程并自动创建 39 个日历预留事件的完整流程
  • 扩展系统为后续专注于软件开发等具体任务场景奠定了基础

视频信息:Customization with Gemini CLI Extensions


中文翻译

Gemini CLI 扩展通过将 MCP 服务器与自定义命令和上下文捆绑在一起,将其提升到了一个新的水平。在本节课中,你将探索拥有数百个选项的扩展库,安装 Google Workspace 扩展,并查看它如何协调文档、日历和表格。让我们深入探讨一下。

Gemini CLI 扩展超越了 MCP,它允许你将一个或多个 MCP 服务器捆绑到一个简单易安装的包中,其中包含自定义上下文文件和自定义斜杠命令。MCP 服务器很棒,但工具的使用方式有时很复杂。它们并没有真正经过训练去了解其单个工具之外的上下文。通过将 MCP 服务器与自定义上下文文件捆绑在一起,你实际上可以告诉 Gemini 如何正确使用任何工具,并真正创建这些复杂的工作流。

Gemini CLI 拥有一个相当庞大的扩展生态系统,目前有超过 200 个扩展。你可以在我们的网站上浏览所有这些扩展。你日常使用的工具很有可能已经是 Gemini CLI 的扩展了。例如,使用 monday.com 扩展,你可以访问 monday.com MCP 服务器,从而查看分配给你的当前任务,更新你的项目看板。它还附带了一个自定义斜杠命令 /sprint-summary,让你可以拉取你团队当前的冲刺(sprint)信息,并获得快速摘要以让你跟上进度。它还带有一个自定义上下文文件。这解释了如何使用 Monday 扩展、最佳实践以及针对其 MCP 服务器的故障排除方法。

对于 TechStack 会议,我们一直在利用 Google Docs 来帮助我们建立会议的计划和日程安排。实际上,我们可以安装 Google Workspace 扩展,从 Google Doc 中的日程表中提取信息,然后直接在我们的日历上为会议安排预留时间。

要获取安装 Google Workspace 扩展的命令,让我们前往 geminicli.com 上的扩展库。点击该图块将带我们进入一键安装命令。运行该命令将提示你确认是否要安装该扩展。一旦扩展成功安装,你可以去打开 Gemini CLI。启动时它将再次触发 OAuth 流程。请继续登录你的邮箱。全选以接受权限。这将允许它访问你的日历以及 Google Docs 等内容。

完成此操作后,你可以返回 Gemini CLI。你可以运行 /extensions list 命令来查看你已安装的所有扩展。让我们继续,要求 Gemini CLI 读取我们的会议日程 Google Doc 并列出会议的时间表。Google Workspace getMe… 它将查询工具以了解当前登录的是谁,以及稍后在其工具中使用的时区。这样,Gemini CLI 就已经读取了我们的 Google Doc,从而获取了会议日程的实际信息。

我是一个大忙人,所以我想确保我提前行动,在我的日历中预留时间,这样在会议进行期间就没有人可以预约我的时间。现在,让我们要求 Gemini CLI 继续并将这些预留时间放入我的日历中。我们要确保实际日历邀请的标题是带有会议环节标题的"预留(hold)"。

Gemini CLI 已经检查了我们的日程安排,并通知我有 39 个日历邀请。它还注意到有一些并发进行的环节。它甚至问我,我们是否应该在日历上安排多个重叠的事件?让我们告诉 Gemini CLI 现在不必担心这个问题,直接安排所有事件即可。

于是,Gemini CLI 继续安排了所有 39 个事件。它在这里给了我们一个快速摘要。让我们来看看。看起来是轻松惬意的几天。好在早餐和午餐都是免费的。

现在你已经看到了扩展 Gemini CLI 功能的所有方法,让我们更进一步,开始关注你可以用 Gemini CLI 完成的任务,例如软件开发。

English Script

Gemini CLI extensions take MCP servers to the next level by bundling them with custom commands and context. In this lesson, you’ll explore the extension gallery with hundreds of options. install the Google Workspace extension and see how it orchestrates across docs, calendar, and sheets. Let’s dive in.

A Gemini CLI extension goes above and beyond MCP by actually allowing you to bundle one or more MCP servers into a simple and easy to install package with a custom context file and custom slash commands. MCP servers are great, but tools sometimes need to be used in complex ways. workflows. They’re not really trained to know the context outside of their individual tools. By bundling MCP servers with a custom context file, you can actually tell Gemini how to properly use any tool and really create these complex workflows.

Gemini CLI has quite a vast extensions ecosystem, currently with over 200 extensions. You can explore all of them on our site. There’s a good chance that tools you’re already using in your day-to-day are Gemini CLI extensions. For example, with the monday.com extension, you can get access to the monday.com MCP server so that you can see your current tasks that are assigned to you, update your project boards. It also comes packaged with a custom slash command, /sprint-summary that lets you pull in your current team’s sprint and get a quick summary to catch you up to speed. It also comes with a custom context file. This explains how to use the Monday extension, best practices, as well as troubleshooting for their MCP server.

For the TechStack conference, we’ve been utilizing Google Docs to help us build up our plan and schedule for the conference. We can actually install the Google Workspace extension to pull in the information from our schedule that is in a Google Doc and then go ahead and actually schedule holds on our calendar for the conference.

To get the command to install the Google Workspace extension, let’s head over to the extensions gallery on geminicli.com. Clicking on the tile will bring us to the one-click install command. Running the command will prompt you to confirm that you want to install the extension. Once the extension has been successfully installed, you can go and open Gemini CLI. It will trigger again an OAuth flow on startup. Go ahead and log in to your email. Select all to accept the permissions. This will give it access to things like your calendar as well as your Google Docs.

Once you’ve completed this, you can head back to Gemini CLI. You can run the /extensions list command to see all the extensions you have installed. Let’s go ahead and ask Gemini CLI to read in our conference schedule Google Doc and list the schedule for the conference. The Google Workspace getMe… It will query tools to know who is currently logged in, as well as what time zone to use in its tools later on. So Gemini CLI has gone and read our Google Doc to actually get the information on the schedule for the conference.

I’m a busy guy, so I want to make sure I get out ahead and put holds in my calendar, so that no one books while the conference is going on. Now let’s ask Gemini CLI to go ahead and put those holds on my calendar. Let’s make sure the title for the actual calendar invite is a hold with the title of the session.

Gemini CLI has gone through our schedule and it’s notifying me that there’s going to be 39 calendar invites. It’s also noticed that there are some concurrent sessions. It’s even asking me, should we do multiple overlapping events on the calendar? Let’s tell Gemini CLI not to worry about that right now and just schedule all the events.

So Gemini CLI went ahead and scheduled all 39 events. It’s going to give us a quick summary here. Let’s check it out. Looks like a chill few days. Good thing breakfast and lunch are free.

Now that you’ve seen all the ways you can extend Gemini CLI’s capabilities, let’s take it a step further and start to focus in on the tasks that you can accomplish with Gemini CLI, such as software development.