Google's New CLI Is The Missing Piece for Claude Code

BBetter Stack
컴퓨터/소프트웨어창업/스타트업AI/미래기술

Transcript

00:00:00Google Workspaces has just become much better for AI agents because they've released a
00:00:04roughed CLI tool that lets your agent interact with any Google Workspace API.
00:00:09So read files from Drive, send emails and even create slides, all built from the ground up
00:00:14for AI agents, meaning they use as little tokens as possible and dynamically create commands at
00:00:19runtime so the APIs are always up to date. But now with a bigger company like Google
00:00:24creating a CLI for what was previously and still is an MCP server, what does that mean
00:00:29for the future of MCP? Hit subscribe and let's find out.
00:00:33Last month I made a video about Playwright making a CLI for what was previously an MCP server.
00:00:42Now it looks like Google Workspaces have done the same thing and people on Twitter are going
00:00:46crazy for it. It's a CLI tool built by Justin who's written a blog post going through everything he did
00:00:52to make it specifically for agents, which we'll talk about later. But it does have over 100
00:00:57skills you can download from skills SH, which of course has made the g-man very happy.
00:01:01But before we jump into what it can do, we need to go through the setup because if we know anything
00:01:06about Google Cloud related tools, it's not that straightforward. Let me show you.
00:01:10First and most importantly, you'll need access to the Google Cloud console. You can make a new
00:01:15project or use an existing one. I made a new one. Then you'll need to have the gcloud CLI installed,
00:01:21which you can do with brew if you're on a Mac. And then with the Google Workspace CLI installed,
00:01:26you'll have to run this command to go through the setup, which is pretty self-explanatory.
00:01:31Use your email for auth, select a GCP project or set one up and then choose the APIs you want
00:01:37access to. Then once you're done for this stage, you'll have to go to API and services credentials
00:01:42and create a new auth client ID, which I believe can be for any application type. I've done web,
00:01:48but I'm sure it will work with desktop because all you need is this client ID and secrets.
00:01:53Then after you've done that, the next stage is where things get a bit tricky because after
00:01:57running this command, you'll have to select your auth scope. For this demo, I selected everything,
00:02:02which isn't ideal, but I was just testing the API. Then you'll get this huge URL to authenticate in
00:02:08your browser. Now, first you need to make sure there aren't any typos in this cause you might
00:02:12get some errors, but you'll need to make note of the port after local host, which in my case is 51065.
00:02:18And then back in the cloud console, click on API and services, auth consent screen,
00:02:23then click on clients, choose your web clients. And then down here where it says authorize redirect
00:02:28your eyes, change this to that port number. So 51065, and then we're not quite done yet.
00:02:33Go to audience, scroll down and add your email address here. If it's not already.
00:02:37Now, if you already have a published app, you won't have this issue,
00:02:40but because I'm just testing the API, I'm using it in test mode.
00:02:44So I need to add my email and the email of all the users. I want to use the CLI over here.
00:02:48Now with that done, you can copy this URL and follow the steps to configure the CLI.
00:02:52And once you're done, you should have a status of success. If you don't see the screen,
00:02:56then wait for a few seconds and try again, because it does take a while to register the redirect URI.
00:03:01This whole process. So just the setup took me the longest amount of time to figure out,
00:03:06which goes to show. I don't use Google cloud tools that often, but once you're done,
00:03:11you should see your details here, meaning the fun can really begin. Check this out.
00:03:15Now I'm going to start simple and ask Claude to give me information about my latest 10 emails.
00:03:19Hopefully there's nothing sensitive in there. And using the GWS CLI,
00:03:24it's given me information about each email with from subject date and labels.
00:03:28And we can see for doing this task, it's just use 9% of the overall context purely because there are
00:03:33no MCP tools here. Most of the context has been used by the messages. Okay. Let's try something
00:03:38else. I'm going to ask Claude to write me a draft email with the subject of I love Claude and a body
00:03:44with a nice poem. Again, it uses the GWS CLI, write some Python using bash. And now that it's finished,
00:03:50we can see, I have a new draft email here written by Claude. Let me zoom in a bit. That contains an
00:03:56email with a poem saying how much I love Claude. Now there's something really interesting about
00:04:00the way Claude uses the GWS CLI. If we take a look at the commands that it's done in the past,
00:04:05we can see here that there are lots of sub commands and there's a params flag with JSON inside it.
00:04:11What's really interesting about this is that if I, as a human wanted to do the same thing
00:04:16by typing in gws help to have a look at all the sub commands, I don't get all of them. I get a handful.
00:04:23And if I want to dive deeper into a specific command, I'd have to use help to get even more
00:04:28information about it and keep doing that over and over again. But the agent is able to get
00:04:32this information really quickly. And even though the exact params to use to get the right data,
00:04:37I mean, look at this. I typed in the prompt over here. It used help once and was able to figure out
00:04:43all this just from that. Now we're going to go into a bit more detail on how it's able to do that,
00:04:48but we can see here that the CLI help section outlines the usage and mentioned the service
00:04:53resource and sub resource. So we can see service down here. And if you want more information,
00:04:57we could also look at gws schema with a service resource and method. Okay, let's try one more
00:05:03thing. I'm going to ask Claude to create a new slides document with one slide containing the
00:05:08title of Claude cat and four other slides containing images of cats. Again, he uses the gws CLI asking
00:05:15for help, then digs into help for the slides and presentations commands. And now it's finished making
00:05:20our presentation. Let's take a look at it in the browser. Here it is. You can see I've already made
00:05:24a test with Claude dogs, but let's try this one. And we have the title called cats with a subtitle,
00:05:30a purified collection with five slides containing images of cats. This is really cool. And we've
00:05:36only used 15% of the context. So we could keep going on and on doing different things. Like here,
00:05:42I've created a Google sheets document containing the population of each of the US States with a
00:05:47total at the bottom and even scheduled events in my calendar. Now you may have noticed I did all of
00:05:52this without installing any Google workspace, specific skills, but the project does have lots
00:05:58of skills available containing helpers, personas, and recipes for more complex actions like blocking
00:06:05focus time and rescheduling a meeting. So how did Justin get this to work so well? First, he
00:06:10prioritized nested Jason, which is difficult for humans to read, but much easier for agents. He also
00:06:16made the documentation queryable at runtime, which we kind of went through earlier, but this schema
00:06:21section over here makes it so that if something updates or the agent enters a wrong parameter,
00:06:26it knows exactly where to go to check what the correct one is without any confusion. The
00:06:31parameters or fields can also be used to reduce the amount of information that comes back from the API.
00:06:36So the agent can limit the information to just what it needs instead of getting some extra information
00:06:42it doesn't need, which reduces the amount of tokens that are used. And of course he uses skills for
00:06:47agent specific guidance, which I didn't use in the demo, but they provide more information than the
00:06:53agent can get from using the help flag. So it's clear MCP servers are out skills and CLIs are in,
00:06:59right? Well, not quite because with MCPs, the agent can just call functions directly instead
00:07:06of having to construct shell commands and pass JSON, which is what the CLI does. MCP tools are
00:07:11also better for chaining complex steps. And of course you don't need a terminal to run them,
00:07:16which is why the Google workspace CLI does have an MCP option. However, CLIs do use way less tokens,
00:07:24even with the tool search tool enabled. They're portable, meaning they can work with any agent
00:07:28harness or without an agent harness, if you don't want to use one. And it's easy to reproduce the
00:07:34commands independently for debugging. So I guess it really depends on your use case, but I did have a
00:07:40few issues when using the CLI, like the generated URLs containing typos, which I have no idea how
00:07:47that happened. The whole redirect URL local host port thing took me a while to figure out. I'm not
00:07:52sure if that's specific to Google cloud tools or just the CLI, but it wasn't fun. And I did have
00:07:59an issue with the tokens not updating correctly that I even created a GitHub issue for. Well,
00:08:05Claude wrote it for me. I actually didn't write any of it, but for a project that's less than a
00:08:10week old with more than 10 K stars on GitHub, it already has a promising future ahead of it.
00:08:16And speaking of promising future, if you ever wanted to create an Electron app powered by bun,
00:08:21so you get the speed and you get the small bundle size, then check out this video I've made on
00:08:26on Electrobahn that shows you how to use it for a simple VEET project.

Key Takeaway

Google's new Workspace CLI provides a token-efficient and highly portable way for AI agents like Claude to perform complex productivity tasks across the entire Google ecosystem.

Highlights

Google released a new Workspace CLI tool specifically optimized for AI agents to interact with Drive, Gmail, and Slides APIs.

The tool uses a dynamic command creation approach and queryable schemas to minimize token usage and keep APIs up to date.

Initial setup requires Google Cloud Console configuration, including setting up OAuth 2.0 credentials and specific redirect URIs.

Claude Code can use the CLI to perform complex tasks like drafting themed emails, creating multi-slide presentations, and managing spreadsheets.

The CLI architecture prioritizes machine-readable nested JSON and selective field filtering over human-readable formatting.

While MCP (Model Context Protocol) is better for direct function calling, CLIs offer superior portability, lower token costs, and easier debugging.

Despite being a new project, the tool has gained significant traction on GitHub and provides over 100 pre-built skills.

Timeline

Introduction to the Google Workspace CLI

The speaker introduces a new tool from Google designed to bridge the gap between AI agents and Workspace APIs. This CLI allows agents to read files, send emails, and create presentations while focusing on low token consumption. A key feature mentioned is the ability for the tool to dynamically create commands at runtime, ensuring that the agents always have access to the latest API versions. The video also touches upon the broader trend of major companies like Playwright and Google moving from MCP servers to dedicated CLI tools. This shift raises important questions about the future of the Model Context Protocol in the developer ecosystem.

Technical Setup and Authentication Hurdles

Setting up the Google Workspace CLI is described as a non-trivial process that requires navigating the Google Cloud Console. Users must create a new project, install the gcloud CLI, and configure OAuth 2.0 client IDs for authentication. The speaker highlights a particularly tricky step involving the authorized redirect URI and port numbers on the local host. He also explains the necessity of adding user emails to the 'Test Users' section of the OAuth consent screen if the app isn't published. This section serves as a practical guide for developers who might struggle with the traditional complexities of Google Cloud permissions.

Practical Demonstrations with Claude Code

The speaker demonstrates the power of the CLI by asking Claude to analyze the last ten emails in his inbox. Claude successfully extracts metadata such as subjects and labels using only 9% of the total context window, proving the tool's efficiency. Further examples include Claude writing an automated poem via email and generating a five-page Google Slides presentation about cats. The agent is shown using the 'help' and 'schema' flags to discover sub-commands and parameters that a human might find difficult to navigate. This demonstrates how the CLI is uniquely tailored for machine reasoning rather than human manual typing.

Architectural Benefits and Agent Optimization

This segment dives into the design philosophy of Justin, the creator of the tool, who prioritized nested JSON structures. While nested JSON is difficult for humans to read, it is significantly easier for AI agents to parse and execute reliably. The documentation is queryable at runtime, meaning if an agent makes a mistake, it can automatically check the schema for the correct parameter. This self-correcting mechanism reduces hallucinations and ensures that the agent only requests the specific data fields it needs. By limiting the information returned from the API, the system effectively lowers the cost and latency of agentic workflows.

CLI vs. MCP: Choosing the Right Tool

The video concludes with a nuanced comparison between using a CLI and an MCP (Model Context Protocol) server. While MCP allows for direct function calling and complex step chaining without a terminal, CLIs are hailed for their portability and ease of debugging. The speaker notes that the Google Workspace CLI actually includes an MCP option to provide users with the best of both worlds. Despite some early-stage bugs like token refresh issues and typos in generated URLs, the project is viewed as a major milestone for AI productivity. The speaker wraps up by inviting viewers to check out his other projects involving Bun and Electron.

Community Posts

View all posts