

Welcome to Part 4 of the Gemini CLI Tutorial series.
Gemini CLI Tutorial Series:
Part 1 : Installation and Getting Started
Part 2 : Gemini CLI Command line options
Part 3 : Configuration settings via settings.json and .env files
Part 4 : Built-in Tools (this post)
Gemini CLI comes with a set of built-in tools and as the documentation states “Gemini model uses this tools to interact with your local environment, access information, and perform actions. These tools enhance the CLI’s capabilities, enabling it to go beyond text generation and assist with a wide range of tasks.”
When it comes to local environment, these are your local file folders, files in them. So for e.g. if you ask Gemini CLI to write code and save that file, it will need to interact with the local file system, current folder and create the file with the contents. If you provide a local folder and ask Gemini to examine the contents of all the files in that folder, then it will need tools to read the folder contents, read each file content and so on.
Its not just about the local environment but there are a few built-in tools that can access the internet, do Google Search based on your query, fetch the contents of a url and so on. Imagine you giving a prompt that says “Fetch the news from xyz site and summarize it for me”.
Please note that this part of the series focuses on built-in tools that come along with Gemini CLI. Do not mix this up for MCP Servers/Tools, which are additional ones that you can configure externally and further enhance the capabilities of Gemini CLI. We shall see that in the next episode.
We will keep the part interactive as I try out on my local setup. At this point, I will assume that you have a working version of Gemini CLI setup. The screenshot below shows that I am setup with Gemini CLI and the tool that authenticated me and is waiting at the prompt input.
The Built-in Tools documentation is over here.
To get a list of current Built-in Tools, we need to simply invoke the /tools
command as shown below:
Most of these tools are self-explanatory based on their names and once we see them in action, it should become obvious in terms of what they do.
One of the things that should strike you immediately is to ask if Gemini CLI can simply call these tools, when it wants to? The default answer is no, when it comes to sensitive operations that might involve writing to the local system, reading from an external system, going to the external network and so on. While there is a --yolo
mode available when you start the CLI, which we will not use, you will find that Gemini CLI will prompt you for permission to run the tool that it has chosen. You can refuse permission, or let it run once or give it blanket permission to always run. You are and should be in full control of things.
You can view the current directory at the bottom left of your Gemini terminal or you can go into shell mode by pressing !
and then giving the command : pwd
in my case.
This gives me the following output:
One of the tools listed above is the ReadFolder
tool. Let’s try and see if Gemini can choose that tool correctly. We give it the following prompt:
Are there any files in the folder?
It responds back with:
This was a simple demonstration of how it picked up the right tool to complete the task that we gave it to do i.e. find if there are files in the folder.
Let’s see the GoogleSearch
tool in action. This tool as the name says performs a web search using Google Search via the Gemini API. It returns a summary of web results with sources.
We shall put it to the test here to get me some news in the finance world in India today and I would like it to save that information in a file named finance-news-today.txt
. In order words, the prompt that I shall give should make Gemini CLI use 2 tools: GoogleSearch
and WriteFile
. Let’s make that happen. I give it the following prompt:
Search for the latest headlines in the Finance world in India
and save them in a file named finance-news-today.txt
This does a Google Search first as shown below:
Then it is trying to write the file as we requested it and is now asking us for permission to use the WriteFile
tool as shown below:
This sounds good and I allow it once. This enables Gemini CLI to use the WriteFile
and the file is then created.
If I go into Shell mode and do a ls
, I can see that the file has got created:
I continue my shell mode and print out the contents of this file.
You can search through the file for specific content. For e.g. I am interested to see if there is any news around “Jio”. I give the following prompt:
Gemini CLI goes to work and provides me the following output:
I ask next about what the WebFetch
tool does?
Cool. This means I could potentially ask it to view maybe a RSS Feed, extract out the content and then summarize it in some form. Let’s try that with the following set of prompts. First I ask it to search for a Google Cloud Blog RSS feed.
GoogleSearch : RSS feed of Google Cloud Blog
This gives back the following:
I give a follow up query to use that RSS feed and get me some news from the feed.
Now let's use that RSS feed. Fetch the content of all the URLs of each item.
Summarize the content for each url and present them in a well formatted way.
Gemini CLI asks me for permission to use the WebFetch
tool to get the content, as shown below:
It does a great job and gets me the news:
I then ask it to save this news by writing it to a file:
Fantastic. Write this to a file named {Todays-Date-in-mmddyyyy-gcp-news.txt}
Its asking me for permission, which I grant:
and then we have our file created by Gemini CLI:
If I go in shell mode and do a ls
, I get the two files listed now:
I can now even do things like convert one of these files to a Markdown (.md) format, as shown below:
Its done the work and is asking me for permission to write the file:
Here is the sample output where I list down the files and also print out the contents of the generated Markdown file, all done via the shell mode.
So far we have dealt with files that had text content. Gemini CLI has multi-model support via Gemini and you can ask it to process files of different content formats as per your requirements. Give it a try for your use case and see if it works.
I am going to demonstrate an example of this by processing a collection of invoices (image formats). The invoices are of different formats and a few samples are shown below:
Here is another one:
So let’s say I have 4 such files (inv1.png
, inv2.png
,inv3.png
, inv4.png
) in a folder and I want Gemini CLI to go through these invoices and extract out specific information from it.
First up, I am in a specific folder in which these invoice files are present and I launch Gemini CLI from there. I ask it the obvious question to find out the contents of the folder:
Let’s give the following prompt to extract out information from the invoices in the form of a table. It goes down to work…
Thats neat, isn’t it? Think of all things you could do now. Organize your local files, analyze your images, extract information from images, fix configuration settings and more.
In this part, we looked at Built-in tools in Gemini CLI. Tools help Gemini gain access to the local environment, work with the file system, execute other tools, CLIs that you might have on your system, access the internet, fetch contents from a url and more. This is a powerful set of tools at your disposal and you can potentially do a lot of housekeeping and/or recurring activities via Gemini CLI. Give it a try and let me know in the comments, what’s the neat little thing that you did with Gemini CLI. Thank you for reading. In the next part, we expand on this and give Gemini CLI some more super powers via MCP Tools.
Source Credit: https://medium.com/google-cloud/gemini-cli-tutorial-series-part-4-built-in-tools-c591befa59ba?source=rss—-e52cf94d98af—4