Gemini CLI: Featuring an Enhanced ToolsForMCPServer

Gists

Abstract

This report introduces ToolsForMCPServer, an enhanced Google Apps Script library that expands the capabilities of Gemini CLI. It showcases new tools that streamline complex workflows, with a special emphasis on facilitating seamless file content transfer and management between a user’s local environment and Google Drive.

Introduction

This report details significant enhancements to ToolsForMCPServer, a powerful Google Apps Script library designed to work in tandem with Gemini CLI. By integrating this library with a Model Context Protocol (MCP) server, the capabilities of Gemini CLI are dramatically expanded, especially in its interaction with Google Workspace services. This document will explore the core architecture that makes this possible, introduce the new tools available in the library, and demonstrate their power through practical examples that bridge the local command line with the cloud.

The Core Architecture: How It Works

The power of this system lies in the synergy between three key components:

  1. Gemini CLI: An open-source tool that brings the power of the Gemini model directly to your command-line interface.
  2. MCP Server: A Model Context Protocol (MCP) server built using Google Apps Script Web Apps. This server acts as the brain, equipped with tools that can interact with Google Workspace services like Drive, Gmail, and Sheets.
  3. ggsrun CLI tool: A command-line utility that acts as a bridge, enabling the crucial transfer of file content between your local machine and the MCP Server running on Google Apps Script.

Together, these components create a powerful feedback loop where you can issue natural language commands in your terminal, and Gemini CLI can orchestrate actions that involve both your local files (via ggsrun) and cloud services (via the MCP Server). This architecture is the foundation for seamless file manipulation between your computer and Google Drive.

The development of this enhanced toolset builds upon a series of foundational reports:

The Enhanced Toolkit: ToolsForMCPServer

To make this ecosystem even more powerful, the ToolsForMCPServer Google Apps Script library was published. The core idea is simple: the more tools the MCP server has, the more you can achieve. This latest update adds several new tools to the library, further expanding the realm of possibilities.

Newly Added Tools

In this update, the following 9 tools were added to the library:

  • get_attachment_files_from_Gmail: Retrieves attachment file IDs from a Gmail message.
  • rename_files_on_google_drive: Renames files on Google Drive.
  • move_files_on_google_drive: Moves files or folders to a different location on Google Drive.
  • convert_mimetype_of_file_on_google_drive: Changes the MIME type of files on Google Drive.
  • generate_roadmap_to_google_sheets: Creates a roadmap in Google Sheets.
  • generate_description_on_google_drive: Generates and sets a description for a file on Google Drive.
  • generate_image_on_google_drive: Generates an image from a prompt and saves it to Google Drive.
  • summarize_file_on_google_drive: Summarizes a file stored on Google Drive.
  • description_web_site: Provides descriptions of websites given their URLs.

In the current stage (July 9, 2025), 32 tools are provided by ToolsForMCPServer for the MCP server.

Usage

You can see how to use this at my repository https://github.com/tanaikech/ToolsForMCPServer?tab=readme-ov-file#usage

Sample Prompts and Answers

This section introduces sample prompts and answers using the Gemini CLI, the MCP server built with Google Apps Script Web Apps, and ggsrun.

Download an image from Google Drive

This example downloads an image file from Google Drive using the ggsrun CLI tool.

Prompt

Download the file "sample.png" from Google Drive using ggsrun.

Answer

  ✔  Shell ggsrun d -f sample.png (Download "sample.png" from Google Drive.)
     {"id":"###","name":"sample.png",,,

✦ The file "sample.png" has been downloaded.

Explanation

When this prompt is run, the file sample.png is downloaded from Google Drive using the ggsrun CLI tool.

Download an image file from a website and upload it to Google Drive

This example downloads an image file from a website using a shell command and uploads it to Google Drive using the ggsrun CLI tool.

Prompt The image at https://www.gstatic.com/marketing-cms/assets/images/7e/a4/253561a944f4a8f5e6dec4f5f26f/gemini.webp=s96-fcrop64=1,00000000ffffffff-rw is the Gemini icon from the official brand resource center. Ref

Download an image from the URL "https://www.gstatic.com/marketing-cms/assets/images/7e/a4/253561a944f4a8f5e6dec4f5f26f/gemini.webp=s96-fcrop64=1,00000000ffffffff-rw" and upload it to Google Drive using ggsrun.

Answer

  ✔  Shell wget -O /home/adsam/temp/workspace/gemini.webp "https://www.gstatic.com/marketing-cms/assets/images/7e/a4/253561a944…

  ✔  Shell ggsrun u -f "gemini.webp" (Upload the downloaded image to Google Drive using ggsrun.)
     Error: Extension of '.webp' cannot be uploaded.

  ✔  Shell convert /home/adsam/temp/workspace/gemini.webp /home/adsam/temp/workspace/gemini.png (Convert the downloaded .webp image...)

  ✔  Shell ggsrun u -f "gemini.png" (Upload the converted .png image to Google Drive using ggsrun.)
     {"upload_file_name":["gemini.png"],"uploaded_files":[{"id":"###","name":"gemini.png","mimeType":"image/png",,,

✦ The image has been successfully downloaded from the URL, converted to PNG format, and uploaded to Google Drive.

Explanation

When this prompt is run, the following steps are executed:

  1. An image file is downloaded using wget.
  2. An attempt to upload the .webp file with ggsrun fails.
  3. The file is converted to the PNG format using the convert command.
  4. The converted .png file is successfully uploaded to Google Drive.

Upload a file to Google Drive and rename it

This example uploads a file to Google Drive using the ggsrun CLI tool and renames it using the rename_files_on_google_drive tool from the MCP server.

Prompt

Upload the file "sample.png" to Google Drive using ggsrun with the filename "test.png". And, show the file ID of the uploaded file.

Answer

  ✔  Shell ggsrun u -f "sample.png:test.png" (Attempt to upload "sample.png" to Google Drive as "test.png"...)
     Error: open sample.png:test.png: no such file or directory.

  ✔  Shell ggsrun u -f "sample.png" (Upload "sample.png" to Google Drive.)
     {"upload_file_name":["sample.png"],"uploaded_files":[{"id":"###","name":"sample.png",,,

  ✔  rename_files_on_google_drive (gas_web_apps MCP Server) {"fileList":[{"fileId":"###","newName…
     FileId: "###". Renamed successfully from "sample.png" to "test.png".

 ✦ The file "sample.png" has been uploaded to Google Drive and renamed to "test.png". The file ID of the uploaded file is ###.

Explanation

When this prompt is run, the following steps are executed:

  1. Upload a file from the local PC to Google Drive using ggsrun.
  2. Rename the uploaded file using the rename_files_on_google_drive tool from the MCP server.
  3. Return the file ID of the uploaded file.

Upload a file to Google Drive and send it as an email attachment

Prompt

Upload the file "sample.png" using ggsrun, create a draft email with the uploaded file as an attachment, and send the email to "tanaike@hotmail.com".

Answer

  ✔  Shell ggsrun u -f "sample.png" (Uploads "sample.png" to Google Drive.)
     {"upload_file_name":["sample.png"],"uploaded_files":[{"id":"###","name":"sample.png",,,

  ✔  auto_new_draft_creation_Gmail (gas_web_apps MCP Server) {"obj":[{"to":"tanaike@hotmail.com","attachmentFiles":["###…
     A draft email was successfully created. The draft ID is "r###".

   ✔  send_mails_Gmail (gas_web_apps MCP Server) {"draftIds":["r###"]}
     Message of "Uploaded File: sample.png" was correctly sent.

✦ I have uploaded the file "sample.png", created a draft email with the uploaded file as an attachment, and sent the email to "tanaike@hotmail.com".

Explanation

A file is uploaded to Google Drive using ggsrun. Then, a new draft email is created with the uploaded file as an attachment using the auto_new_draft_creation_Gmail tool. Finally, the draft email is sent using the send_mails_Gmail tool.

Move a file in Google Drive

Prompt

Move the file "sample.png" to the folder "temp_folder" on Google Drive.

Answer

 ✔  search_file_in_google_drive (gas_web_apps MCP Server) {"query":"name = 'sample.png'"}
    1 files were found.
    The list of found files is returned in the "FileList" JSON array.

 ✔  search_file_in_google_drive (gas_web_apps MCP Server) {"query":"name = 'temp_folder' and mimeType = 'application/vnd.googl…
    1 files were found.
    The list of found files is returned in the "FileList" JSON array.

 ✔  move_files_on_google_drive (gas_web_apps MCP Server) {"fileList":[{"dstId":"###","srcId":"1j…
    File "sample.png" was moved to the folder "temp_folder".

✦ I have moved the file "sample.png" to the folder "temp_folder" on Google Drive.

Explanation

This prompt executes the following steps:

  1. The file and folder are located by name to retrieve their IDs using the search_file_in_google_drive tool.
  2. The file is moved to the destination folder using the move_files_on_google_drive tool.

Upload a PDF file to Google Drive and add a description

The sample PDF file is PhysRev.48.73.pdf. This is from this page.

Prompt

Upload the PDF file PhysRev.48.73.pdf to Google Drive using ggsrun and set the description for the file.

Answer

  ✔  Shell ggsrun u -f "PhysRev.48.73.pdf" (Uploads the PDF file "PhysRev.48.73.pdf" to Google Drive.)
     {"upload_file_name":["PhysRev.48.73.pdf"],"uploaded_files":[{"id":"###",,,

  ✔  generate_description_on_google_drive (gas_web_apps MCP Server) {"fileId":"###"}
     The created description is "This file is a scientific paper titled "The Particle Problem in the General Theory of Relativity" authored by A. Einstein and N. Rosen, published in Physical Review, Volume 48, pages 73-77, on July 1, 1935...

✦ The PDF file PhysRev.48.73.pdf has been uploaded to Google Drive and its description has been set.

Explanation

In this prompt, the PDF file PhysRev.48.73.pdf is uploaded to Google Drive using ggsrun. Then, a description for the PDF file is generated and set using the generate_description_on_google_drive tool from the MCP server.

Generate an image

Prompt

Generate an image of orange juice being poured into a glass, and download it.

Answer

  ✔  generate_image_on_google_drive (gas_web_apps MCP Server) {"prompt":"orange juice is poured into a glass"}
     An image was successfully generated from a prompt "orange juice is poured into a glass" as a file on Google Drive. The file URL and ID are "https://drive.google.com/file/d/###/view?usp=drivesdk" and "###", respectively.

  ✔  Shell ggsrun d -i ### -o "orange juice is poured into a glass" (Downloads the generated image...)
     {"id":"###","name":"orange juice is poured into a glass",,,,

✦ The image "orange juice is poured into a glass" has been generated and downloaded to your current directory.

The following image was generated and downloaded.

Explanation

An image is generated using the generate_image_on_google_drive tool from the MCP server and then downloaded using ggsrun.

Describe a website

Prompt

Describe the website "https://tanaikech.github.io/about/".

Answer

  ✔  description_web_site (gas_web_apps MCP Server) {"urls":["https://tanaikech.github.io/about/"]}
     The website "About · tanaike" belongs to a Japanese scientist with a Ph.D. in Physics, who is also a Google Developer Expert (GDE) in Google Workspace and a Google Cloud Champion Innovator. The individual focuses on creating novel solutions, with some inventions finding practical applications in various industries such as electronics, industrial machinery, architecture, and aerospace. The site provides contact information, including a developer profile, and links to their posts on the Google Cloud Blog, Medium, and Zenn. It also lists their activities on platforms like GitHub, Gists, Qiita, Stack Overflow, and X, showcasing applications, tips, and summaries of Google Apps Script related repositories. The site also includes information about donations via PayPal.Me.

✦ The website "About · tanaike" describes a Japanese scientist with a Ph.D. in Physics, who is also a Google Developer Expert (GDE) in Google Workspace and a Google Cloud Champion Innovator. The individual focuses on creating novel solutions, with some inventions finding practical applications in various industries. The site provides contact information and links to their posts on various platforms like Google Cloud Blog, Medium, Zenn, GitHub, and Stack Overflow, showcasing applications, tips, and summaries of Google Apps Script related repositories.

Explanation

In this example, a description of the website is generated using the description_web_site tool from the MCP server.

Describe a PDF file on the local PC

Prompt

Upload the PDF file PhysRev.48.73.pdf to Google Drive using ggsrun and return a summary of the PDF file within 100 words.

Answer

  ✔  Shell ggsrun u -f "PhysRev.48.73.pdf" (Uploads the PDF file to Google Drive.)
     {"upload_file_name":["PhysRev.48.73.pdf"],"uploaded_files":[{"id":"###",,,

  ✔  summarize_file_on_google_drive (gas_web_apps MCP Server) {"prompt":"Summarize this PDF file within 100 words.","fileId":"1…
     Einstein and Rosen investigate the particle problem in general relativity, aiming to describe elementary particles without singularities. They propose a slight modification to the gravitational equations, allowing for regular solutions. In this framework, particles are represented as "bridges" connecting two identical "sheets" of space. This approach provides a singularity-free description for neutral and charged particles. The most natural charged particle in this model is found to have zero gravitational mass. The theory offers a unified, consistent view using only gravitational and electromagnetic fields, explaining the atomistic nature of matter and the absence of negative neutral mass.

✦ The PDF file "PhysRev.48.73.pdf" has been uploaded to Google Drive and summarized as follows:
  "Einstein and Rosen investigate the particle problem in general relativity, aiming to describe elementary particles without singularities. They propose a slight modification to the gravitational equations, allowing for regular solutions. In this framework, particles are represented as 'bridges' connecting two identical 'sheets' of space. This approach provides a singularity-free description for neutral and charged particles. The most natural charged particle in this model is found to have zero gravitational mass. The theory offers a unified, consistent view using only gravitational and electromagnetic fields, explaining the atomistic nature of matter and the absence of negative neutral mass."

Explanation

A PDF file is uploaded to Google Drive using ggsrun, and a summary is generated using the summarize_file_on_google_drive tool from the MCP server.

Generate a roadmap and download it as a PDF file

Prompt

I want to cook miso soup. To achieve this goal, create a new Google Spreadsheet, generate a roadmap for cooking miso soup in the spreadsheet, and download it as a PDF file using ggsrun.

Answer

  ✔  create_file_to_google_drive (gas_web_apps MCP Server) {"filename":"Miso Soup Roadmap","mimeType":"application/vnd.google-a…
     A file was created on the root folder. The file URL is "https://docs.google.com/spreadsheets/d/###/edit?usp=drivesdk".

  ✔  generate_roadmap_to_google_sheets (gas_web_apps MCP Server) {"spreadsheetId":"###…
     Roadmap was successfully generated in Google Sheets. The spreadsheet ID and the sheet name are "###" and "Sheet1" (sheet ID: "0"), respectively. The URL is "https://docs.google.com/spreadsheets/d/###/edit". The file ID of the converted PDF file is "###".

✦ I can run ggsrun d -i ###. This will download the PDF file of the miso soup roadmap from Google Drive to your local machine.

  ✔  Shell ggsrun d -i ### (Download the generated PDF roadmap from Google Drive.)

✦ I have successfully created the Google Spreadsheet, generated the roadmap for cooking miso soup, and downloaded it as a PDF file named Cook Miso Soup.pdf.

As a result, the following roadmap is generated and saved as a PDF file:

Explanation

When this prompt is run, the following steps are executed:

  1. Create a new Google Spreadsheet using the create_file_to_google_drive tool from the MCP server.
  2. Generate a roadmap in the new spreadsheet using the generate_roadmap_to_google_sheets tool.
  3. Download the roadmap as a PDF file from Google Drive using ggsrun.

Generate presentation based on a web site and send it as an email

Prompt

Describe the Web site of "https://blog.google/technology/developers/introducing-gemini-cli-open-source-ai-agent/", and think of a title and create a new Google Document and put the generated description into the document by giving the title. And, generate a presentation of Google Slides using the title and document. And, create an email including the URL of the presentation and send it to "tanaike@hotmail.com".

Answer

  ✔  description_web_site (gas_web_apps MCP Server) {"urls":["https://blog.google/technology/developers/introducing-gemini-cli-…
     The site describes the introduction of Gemini CLI, an open-source AI agent that integrates Gemini directly into
     developers' terminals. This tool offers free access to Gemini 2.5 Pro for individual Google account holders,
     with high usage limits for model requests. Gemini CLI aims to enhance the command-line experience by enabling
     coding, problem-solving, content generation, and task management using natural language. It shares technology
     with Gemini Code Assist, providing AI assistance in both the terminal and VS Code. The article highlights
     Gemini CLI's open and extensible nature, encouraging community contributions.

  ✔  create_file_to_google_drive (gas_web_apps MCP Server) {"mimeType":"application/vnd.google-apps.document","filename":"Intro…
     A file was created on the root folder. The file URL is "https://docs.google.com/document/d/###/edit?usp=drivesdk".

  ✔  put_values_into_google_docs (gas_web_apps MCP Server) {"text":"The site describes the introduction of Gemini CLI, an open-…
     Text is appended successfully to Google Docs.

  ✔  generate_presentation_with_google_slides (gas_web_apps MCP Server) {"name":"Kanshi Tanaike","title":"Introducing Gemini CL…
     Presentation was successfully created. The url is "https://docs.google.com/open?id=###".

  ✔  auto_new_draft_creation_Gmail (gas_web_apps MCP Server) {"obj":[{"body":"Here is the presentation on Introducing Gemini CL…
     A draft email was successfully created. The draft ID is "r-###".

  ✔  send_mails_Gmail (gas_web_apps MCP Server) {"draftIds":["r-###"]}
     Message of "Presentation: Introducing Gemini CLI: An Open-Source AI Agent" was correctly sent.

✦ I have successfully described the website, created a Google Document with the description and a title, generated a Google Slides presentation, and sent an email with the presentation URL to "tanaike@hotmail.com".

The following email was sent.

Mail subject: Presentation: Introducing Gemini CLI: An Open-Source AI Agent
Mail body: Here is the presentation on Introducing Gemini CLI: An Open-Source AI Agent: https://docs.google.com/open?id=###

When the URL is opened, the following presentation was generated.

Explanation

When this prompt is run, the following steps are executed:

  1. A tool description_web_site generates a description of the web site.
  2. A tool create_file_to_google_drive creates a new Google Document.
  3. A tool put_values_into_google_docs puts the generated description into the created document.
  4. A tool generate_presentation_with_google_slides generates a presentation to Google Slides using the title and Google Document.
  5. A tool auto_new_draft_creation_Gmail creates a draft email including the URL of the Google Slides.
  6. A tool send_mails_Gmail sends the email.

Summary

  • Powerful Integration: By combining Gemini CLI with a Google Apps Script-based MCP Server, you can unlock powerful new capabilities that extend beyond the command line into the Google Workspace ecosystem.
  • Seamless File Transfer: The ggsrun CLI tool is a critical component, acting as a bridge that enables smooth uploading and downloading of files between your local machine and Google Drive, orchestrated by natural language prompts.
  • Enhanced Toolkit: The ToolsForMCPServer library significantly expands the range of actions you can perform, with new tools for renaming, moving, describing, and generating content directly on Google Drive.
  • Complex Workflow Automation: This system allows Gemini CLI to orchestrate multi-step workflows, such as uploading a local file, processing it in the cloud (e.g., summarizing a PDF or generating a presentation), and then sending the result via email or downloading it back to your machine.
  • Extensible and Open: The architecture is fundamentally extensible. Developers can add their own custom tools to the Google Apps Script library, creating near-infinite possibilities for custom automation and integration.

 Share!