The Gemini CLI confirmed that the MCP server built with Google Apps Script (GAS), a low-code platform, offers immense possibilities. If you've created snippets for GAS, these could be revitalized and/or leveraged in new ways by using them as the MCP server. The Gemini CLI and other MCP clients will be useful in achieving this.
The Gemini CLI provides a powerful command-line interface for interacting with Google's Gemini models. By leveraging the Model Context Protocol (MCP), the CLI can be extended with custom tools. This report explores the integration of the Gemini CLI with an MCP server built using Google Apps Script Web Apps. We demonstrate how this combination simplifies authorization for Google Workspace APIs (Gmail, Drive, Calendar, etc.), allowing Gemini to execute complex, multi-step tasks directly within the Google ecosystem. We provide setup instructions and several practical examples showcasing how this integration unlocks significant potential for automation and productivity enhancement.
Recently, I published a report titled "Gemini CLI with MCP Server Built by Web Apps of Google Apps Script" (Ref). This initial report highlighted how a Model Context Protocol (MCP) server, developed using Google Apps Script Web Apps, can be integrated with the Gemini CLI.
One of the key advantages of using Google Apps Script is its ability to provide seamless authorization for Google APIs, particularly those within Google Workspace. This significantly reduces the development overhead associated with building applications that interact with Google Workspace services.
Building upon that foundation, this report aims to explore the expanded possibilities when combining the Gemini CLI with an MCP server powered by Google Apps Script Web Apps. We will delve into how this powerful combination facilitates the integration of various tools and services, unlocking an infinite range of potential applications for enhanced productivity and automation within the Google ecosystem.
In the current stage (July 17, 2025), the following 41 tools are provided by ToolsForMCPServer for the MCP server.
get_exchange_rate(currency_date, currency_from, currency_to)
: Gets the current exchange rate between two currencies for a given date.get_current_weather(latitude, longitude, timezone)
: Gets the current weather for latitude, longitude, and timezone.get_specific_date_weather(date, latitude, longitude, timezone)
: Gets the weather for a specified date, latitude, longitude, and timezone.get_current_date_time(timezone)
: Returns the current date and time for a given timezone.search_schedule_on_Google_Calendar(end, start, search)
: Searches for schedules and events on Google Calendar within a date range, with an optional search string.create_schedule_to_Google_Calendar(description, endDatetime, startDatetime, title)
: Creates an event (schedule) on Google Calendar with a title, description, start, and end datetime.get_values_from_google_docs(documentId, documentUrl, markdown, tabId, tabIndex, tabName)
: Retrieves text content from Google Docs, optionally in Markdown format, from a specific tab.put_values_into_google_docs(documentId, documentUrl, index, tabId, tabIndex, tabName, text)
: Appends or inserts text into Google Docs at a specified index or to the end, in a specific tab.get_google_doc_object_using_docs_api(documentId)
: Get Google Docs Object using Docs API.manage_google_docs_using_docs_api(documentId, requests)
: Manage Google Docs using Docs API.search_file_in_google_drive(query)
: Searches for files in Google Drive using a search query.get_file_from_google_drive(filename)
: Downloads a file from Google Drive by filename, returning base64 encoded data.put_file_to_google_drive(base64Data, filename, mimeType)
: Uploads base64 encoded data to Google Drive as a file with a specified filename and MIME type.create_file_to_google_drive(filename, mimeType)
: Creates an empty file on Google Drive with a specified filename and MIME type.rename_files_on_google_drive(fileList)
: Renames files on Google Drive using their file IDs and new names.move_files_on_google_drive(fileList)
: Moves files and folders to a different folder on Google Drive using source anddestination IDs.convert_mimetype_of_file_on_google_drive(dstMimeType, fileIds)
: Converts the MIME type of files on Google Drive.change_permission_of_file_on_google_drive
: This is used to modify the access permissions of a specific file or folder on Google Drive for a given user.generate_survey_with_google_forms(itemList, title)
: Generates a survey using Google Forms with a given title and a list of questions.generate_quiz_with_google_forms(itemList, title)
: Generates a quiz using Google Forms with a given title and a list of questions, including correct answers.get_massages_by_time_from_Gmail(after, excludedMessageIds)
: Retrieves Gmail messages received after a specified time, with an option to exclude certain message IDs.get_massages_by_search_from_Gmail(query, excludedMessageIds)
: Retrieves Gmail messages using a search query, with an option to exclude certain message IDs.get_attachment_files_from_Gmail(messageId)
: Retrieves attachment files from a Gmail message, returning their Google Drive file IDs.add_label_to_Gmail(obj)
: Adds labels to specified Gmail threads.auto_reply_draft_creation_Gmail(obj)
: Creates automatically drafted reply emails in Gmail for specified messages, with optional attachments.auto_new_draft_creation_Gmail(obj)
: Creates automatically drafted new emails in Gmail, with specified recipients, titles, bodies, and optional attachments.send_mails_Gmail(draftIds)
: Sends previously created draft emails in Gmail.remove_mails_Gmail(messageIds)
: Removes specified Gmail messages.get_values_from_google_sheets(range, sheetId, sheetIndex, sheetName, spreadsheetId, spreadsheetUrl)
: Retrieves values from Google Sheets from a specified range or sheet.put_values_to_google_sheets(range, sheetId, sheetIndex, sheetName, spreadsheetId, spreadsheetUrl, values)
: Puts values into Google Sheets at a specified range or to the last row of a sheet.search_values_from_google_sheets(spreadsheetId, spreadsheetUrl, searchText)
: Search all cells in Google Spreadsheet using a regex.get_google_sheet_object_using_sheets_api(spreadsheetId)
: Get Google Sheets Object using Sheets API.manage_google_sheets_using_sheets_api(spreadsheetId, requests)
: Manage Google Sheets using Sheets API.generate_presentation_with_google_slides(name, presentationTime, text, title)
: Creates and generates a presentation using Google Slides with a title, speaker name, presentation time, and description.get_google_slides_object_using_slides_api(presentationId)
: Get Google Slides Object using Slides API.manage_google_slides_using_slides_api(presentationId, requests)
: Manage Google Slides using Slides API.generate_description_on_google_drive(fileId)
: Generates a description for a file on Google Drive and sets it.generate_image_on_google_drive(prompt)
: Generates an image from a prompt and saves it as a file on Google Drive.summarize_file_on_google_drive(fileId, prompt)
: Summarizes a file on Google Drive based on a given prompt.generate_roadmap_to_google_sheets(description, exportPDF, goal, sheetId, sheetIndex, sheetName, spreadsheetId, spreadsheetUrl)
: Generates a roadmap in Google Sheets, with options to export as PDF.description_web_site(urls)
: Describes websites using their URLs.
This section details deploying the MCP server using Google Apps Script and configuring the Gemini CLI to use it.
First, create a new standalone Google Apps Script project. A standalone project is not bound to a specific Google Sheet, Doc, or Form, making it ideal for creating a general-purpose web service. You can create one by visiting script.google.com. Ref
To simplify building the MCP server, we will use pre-built Google Apps Script libraries. These encapsulate the complex MCP handling logic and provide ready-to-use tools, keeping the main script clean.
This sample uses two Google Apps Script libraries:
- MCPApp: Manages the MCP server lifecycle and communication protocols.
- ToolsForMCPServer: Provides a suite of pre-built tools for interacting with Google Workspace services (Gmail, Drive, Calendar, etc.).
- Open the script editor of the project you just created.
- Install MCPApp:
- Installation Guide
- Project Key:
1TlX_L9COAriBlAYvrMLiRFQ5WVf1n0jChB6zHamq2TNwuSbVlI5sBUzh
- Identifier:
MCPApp
- Repository: https://github.com/tanaikech/MCPApp
- Install ToolsForMCPServer:
- Installation Guide
- Project Key:
1lnE7UL1jQgPDbTB9yjhiwZM0SaS9MObhzvWUWb_t8FisO6A3bLepvM2j
- Identifier:
ToolsForMCPServer
- Repository: https://github.com/tanaikech/ToolsForMCPServer
Please copy and paste the following script into the script editor (replacing any existing code) and save the project.
This is a basic script for using this library.
const apiKey = "###"; // API key for Gemini API
/**
* This function is automatically run when the MCP client accesses Web Apps.
*/
const doPost = e => main(e);
function main(eventObject) {
const m = ToolsForMCPServer;
m.apiKey = apiKey;
const object = { eventObject, items: m.getTools() };
return new MCPApp
.mcpApp({ accessKey: "sample" })
.setServices({ lock: LockService.getScriptLock() })
.server(object);
}
Note:
- If you intend to use the following tools, you must uncomment the
apiKey
line in the script and provide a valid API key for the Gemini API.- 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.
- If an error related to Drive API occurred, please enable Drive API at Advanced Google services.
- If you want to manage Docs, Sheets, and Slides using the batch update methods of API, please enable Docs API, Sheets API, and Slides API at Advanced Google services.
When this script is run, all tools in this library are shown as a JSON object.
function showAlltools() {
const res = ToolsForMCPServer.getToolList();
console.log(res);
}
When you want to use the specific tools, you can also use the following script.
This script uses only the tool get_exchange_rate
.
function main(eventObject) {
const enables = ["get_exchange_rate"];
const m = ToolsForMCPServer;
m.apiKey = apiKey;
const object = { eventObject, items: m.getTools({ enables }) };
return new MCPApp
.mcpApp({ accessKey: "sample" })
.setServices({ lock: LockService.getScriptLock() })
.server(object);
}
This script uses all tools except for the tool get_exchange_rate
.
function main(eventObject) {
const disables = ["get_exchange_rate"];
const m = ToolsForMCPServer;
m.apiKey = apiKey;
const object = { eventObject, items: m.getTools({ disables }) };
return new MCPApp
.mcpApp({ accessKey: "sample" })
.setServices({ lock: LockService.getScriptLock() })
.server(object);
}
To allow the Gemini CLI to communicate with our script, we must deploy it as a Web App. This creates a unique URL that acts as our MCP server endpoint.
You can find detailed information in the official documentation.
Please follow these steps to deploy the Web App in the script editor:
- In the script editor, at the top right, click Deploy -> New deployment.
- Click Select type -> Web App.
- Enter a description for the Web App in the fields under Deployment configuration.
- Select "Me" for "Execute as". This is crucial, as it allows the script to run with your permissions to access your Google services.
- Select "Anyone" for "Who has access". This makes the URL callable from the internet. Access is controlled by the unguessable URL and the
accessKey
defined in the script. - Click Deploy.
- After authorizing the necessary scopes, copy the Web app URL. It will look similar to
https://script.google.com/macros/s/###/exec
. This is your MCP server endpoint.
Important: When you modify the Apps Script code, you must create a new deployment version to publish the changes. Click Deploy > Manage deployments, select your active deployment, click the pencil icon, and choose "New version" from the Version dropdown. More info here.
Follow the official documentation to install the Gemini CLI on your system. Ref
To connect the Gemini CLI to your new Apps Script server, you need to edit its settings file. This file is typically located at ~/.gemini/settings.json
on macOS/Linux or %USERPROFILE%\.gemini\settings.json
on Windows.
Add the mcpServers
configuration block as shown below.
- Replace
https://script.google.com/macros/s/###/exec
with the Web App URL you copied earlier. - Ensure the
accessKey
query parameter matches theaccessKey
you defined in your Google Apps Script (sample
in this example).
{
"theme": "Default",
"selectedAuthType": "###",
"mcpServers": {
"gas_web_apps": {
"command": "npx",
"args": [
"mcp-remote",
"https://script.google.com/macros/s/###/exec?accessKey=sample"
],
"env": {}
}
}
}
"gas_web_apps"
: A local identifier for your server."command"
and"args"
: These tell the Gemini CLI how to invoke themcp-remote
tool, which handles the communication with your Web App URL.
When you have never installed mcp-remote
, please install it. Ref
Recently, I published a report titled "Processing File Content Using Gemini CLI with an MCP Server Built by Google Apps Script" Ref. In this report, I concluded that using the Drive API in the background is more effective for transferring file content between Gemini CLI and Google Drive than embedding base64 data directly in the prompt. Therefore, to facilitate this effective transfer, I use ggsrun, a CLI tool.
To use this method, you first need to set up ggsrun
.
- Download
ggsrun
: Get the latest release from the ggsrun releases page. The main repository is here. - Create a Google Cloud Project: Go to the Google Cloud Platform Resource Manager and click CREATE PROJECT.
- Enable Drive API: In your new project, navigate to APIs & Services > Enabled APIs & Services. Search for and enable the Drive API.
- Create Credentials: Navigate to APIs & Services > Credentials.
- Configure OAuth Client ID: Click Create credentials, select OAuth client ID, and choose Web Application.
- Set Redirect URI: Under "Authorized redirect URIs," add
http://localhost:8080
. - Create and Download Credentials: Click Create, then Download JSON. Important: Rename the downloaded file to
client_secret.json
and place it in your working directory. - Authenticate
ggsrun
:
8-1. Open your terminal in the directory containing client_secret.json
.
8-2. Run the command ggsrun auth
.
8-3. Copy the URL displayed in the terminal, paste it into your browser, and authorize the requested scopes.
8-4. Copy the authorization code from your browser's address bar and paste it back into the terminal.
To verify the setup, run ggsrun di
to display information about your Google Drive.
To enable the Gemini CLI to use ggsrun
, add the following tool definitions to your GEMINI.md
file. This file is typically located at ~/.gemini/GEMINI.md
on macOS/Linux or %USERPROFILE%\.gemini\GEMINI.md
on Windows.
# Transferring file content between local PC and Google Drive using ggsrun
* GitHub Repository: [https://github.com/tanaikech/ggsrun](https://github.com/tanaikech/ggsrun)
* To download a file from Google Drive by filename, use this command:
```bash
ggsrun d -f [filename]
```
* To download a file from Google Drive by file ID, use this command:
```bash
ggsrun d -i [fileId]
```
* To upload files from the local PC to the root directory of Google Drive, use this command:
```bash
ggsrun u -f "[filename1],[filename2],,,"
```
* To upload files from the local PC to a specific directory of Google Drive, use this command:
```bash
ggsrun u -p [folderId] -f "[filename1],[filename2],,,"
```
* To search for files and folders on Google Drive, use this command:
```bash
ggsrun sf -q "[search query of Drive API v3 ([https://developers.google.com/workspace/drive/api/guides/search-shareddrives](https://developers.google.com/workspace/drive/api/guides/search-shareddrives))]"
```
* To search for files and folders on Google Drive, use this command:
```bash
ggsrun ls -s [filename]
The following examples demonstrate how the Gemini CLI uses the Google Apps Script MCP server to interact with various Google services.
This command lists all configured MCP servers and the tools they provide.
Prompt
> /mcp
When your setting is correct, the following result is returned.
Answer
ℹ Configured MCP servers:
🟢 gas_web_apps - Ready (41 tools)
- get_exchange_rate
- get_current_weather
- get_specific_date_weather
- get_current_date_time
- search_schedule_on_Google_Calendar
- create_schedule_to_Google_Calendar
- get_values_from_google_docs
- put_values_into_google_docs
- get_google_doc_object_using_docs_api
- manage_google_docs_using_docs_api
- search_file_in_google_drive
- get_file_from_google_drive
- put_file_to_google_drive
- create_file_to_google_drive
- rename_files_on_google_drive
- move_files_on_google_drive
- convert_mimetype_of_file_on_google_drive
- change_permission_of_file_on_google_drive
- generate_survey_with_google_forms
- generate_quiz_with_google_forms
- get_massages_by_time_from_Gmail
- get_massages_by_search_from_Gmail
- get_attachment_files_from_Gmail
- add_label_to_Gmail
- auto_reply_draft_creation_Gmail
- auto_new_draft_creation_Gmail
- send_mails_Gmail
- remove_mails_Gmail
- get_values_from_google_sheets
- put_values_to_google_sheets
- search_values_from_google_sheets
- get_google_sheet_object_using_sheets_api
- manage_google_sheets_using_sheets_api
- generate_presentation_with_google_slides
- get_google_slides_object_using_slides_api
- manage_google_slides_using_slides_api
- generate_description_on_google_drive
- generate_image_on_google_drive
- summarize_file_on_google_drive
- generate_roadmap_to_google_sheets
- description_web_site
Prompt
Search for files with the filename of "sample file" from Google Drive.
Answer
✔ search_file_in_google_drive (gas_web_apps MCP Server) {"query":"name = 'sample file'"}
✦ I found a file named "sample file" on Google Drive. It's a Google Sheet, and here's its link:
https://docs.google.com/spreadsheets/d/###/edit?usp=drivesdk
Gemini interpreted the request and selected the search_file_in_google_drive
tool from the gas_web_apps
MCP server. It constructed the appropriate Google Drive search query (name = 'sample file'
) and executed the search via Google Apps Script, returning the file metadata.
Prompt
Tell me my today's schedule.
Answer
✔ search_schedule_on_Google_Calendar (gas_web_apps MCP Server) {"start":"2025-07-03","end":"2025-07-03"}
✦ Today, July 3, 2025, you have two events:
- 12:00 PM - 1:00 PM: "sample event 1" (Lunch) at Shinagawa Station.
- 7:00 PM - 8:00 PM: "sample event 2" (Dinner) at Osaka Station.
The model used the search_schedule_on_Google_Calendar
tool, automatically determining the correct start and end dates for "today". The MCP server fetched the events from Google Calendar, and Gemini summarized the results.
Prompt
Tell me my today's emails from [email protected].
Answer
✔ get_messages_by_search_from_Gmail (gas_web_apps MCP Server) {"query":"from:[email protected] after:2025/07/03"}
✦ Here are your emails from [email protected] for today:
1. From: Tanaike Kanshi <[email protected]>
Subject: sample mail 2
Body: This is a sample mail of No.2.
2. From: Tanaike Kanshi <[email protected]>
Subject: sample mail 1
Body: This is a sample mail of No.1.
Gemini utilized the get_messages_by_search_from_Gmail
tool, correctly formulating a Gmail search query (from:[email protected] after:2025/07/03
) to meet the constraints of the prompt.
Prompt
I received a souvenir from my friend Tanaike. Create an email to thank him for it. Tanaike's email address is [email protected].
Answer
✔ auto_new_draft_creation_Gmail (gas_web_apps MCP Server) {"obj":[{"body":"Dear Tanaike,\n\nThank you so much for the wonder…
A draft email was successfully created. The draft ID is "r-###".
✔ send_mails_Gmail (gas_web_apps MCP Server) {"draftIds":["r-###"]}
Message of "Thank you for the souvenir!" was correctly sent.
✦ I have already sent the email to Tanaike thanking him for the souvenir.
The following email was automatically sent to [email protected]:
Dear Tanaike,
Thank you so much for the wonderful souvenir! I really appreciate your
thoughtfulness.
Best regards,
Kanshi Tanaike
This prompt required two steps. First, Gemini used auto_new_draft_creation_Gmail
to generate the email content and create a draft within Gmail via the MCP server. Second, it immediately used the send_mails_Gmail
tool, passing the draft ID from the first step to send the email.
This example demonstrates complex orchestration involving web search and multiple MCP tools. This prompt is similar to one found in this reference: Ref
Prompt
Check tomorrow's weather conditions at 12 PM around Shinagawa Station and exchange 100 US Dollars for Japanese Yen. Under this condition, will we enjoy eating lunch outside for 1 hour at the retrieved location and that day? Finally, create it as a schedule in Google Calendar.
Answer
✔ GoogleSearch Searching the web for: "latitude and longitude of Shinagawa Station"
Search results for "latitude and longitude of Shinagawa Station" returned.
✔ get_current_date_time (gas_web_apps MCP Server) {"timezone":"Asia/Tokyo"}
The current date and time are "2025-07-03 11:04:42". Timezone is "Asia/Tokyo".
✔ get_exchange_rate (gas_web_apps MCP Server) {"currency_from":"USD","currency_to":"JPY"}
The raw data from the API is {"amount":1.0,"base":"USD","date":"2025-07-02","rates":{"JPY":144.15}}. The detailed result is as follows. The currency rate at latest from "USD" to "JPY" is 144.15.
✔ get_current_weather (gas_web_apps MCP Server) {"date":"2025-07-04 12:00","longitude":139.73917,"latitude":35.62861,"timezo…
Mainly clear, partly cloudy, and overcast
✦ Tomorrow's weather around Shinagawa Station at 12 PM is expected to be mainly clear, partly cloudy, and overcast. The exchange rate for 100 US Dollars is 14415 Japanese Yen (1 USD = 144.15 JPY).
Given the weather conditions, it might be enjoyable to eat lunch outside, but there's a chance of it being overcast.
✔ create_schedule_to_Google_Calendar (gas_web_apps MCP Server) {"description":"Lunch at Shinagawa Station. Weather: Mainly c…
An event was created as Start: 2025-07-04 12:00:00, End: 2025-07-04 13:00:00, Title: Outdoor Lunch at Shinagawa Station, Description: Lunch at Shinagawa Station. Weather: Mainly clear, partly cloudy, and overcast. Exchange rate: 1 USD = 144.15 JPY.
✦ The schedule for an outdoor lunch at Shinagawa Station tomorrow, July 4, 2025, from 12:00 PM to 1:00 PM, has been created in your Google Calendar. The description includes the weather forecast (mainly clear, partly cloudy, and overcast) and the exchange rate (1 USD = 144.15 JPY).
The following event was automatically created in Google Calendar:
Date: July 4, 2025, from 12:00 PM to 1:00 PM
Title: Outdoor Lunch at Shinagawa Station
Description: Lunch at Shinagawa Station. Weather: Mainly clear, partly cloudy, and overcast. Exchange rate: 1 USD = 144.15 JPY.
This involved a complex chain of actions:
- Gemini used the standard
GoogleSearch
to find the latitude and longitude of Shinagawa Station. - It used the MCP tool
get_current_date_time
to establish the date. - It used
get_exchange_rate
to find the USD to JPY conversion. - It used
get_current_weather
, inputting the coordinates found in step 1 and the date/time. - Gemini synthesized this information to answer the qualitative question about enjoying lunch.
- Finally, it used
create_schedule_to_Google_Calendar
, embedding the retrieved weather and exchange rate information into the event description.
Prompt
Append the following text to the document "sample document 20250703".
<Text>
sample text 1
sample text 2
sample text 3
sample text 4
sample text 5
</Text>
Answer
✔ search_file_in_google_drive (gas_web_apps MCP Server) {"query":"sample document 20250703"}
"isError": true
✔ search_file_in_google_drive (gas_web_apps MCP Server) {"query":"name = 'sample document 20250703'"}
1 files were found.
✔ put_values_into_google_docs (gas_web_apps MCP Server) {"text":"sample text 1\nsample text 2\nsample text 3\nsample text 4\…
Text is appended successfully to Google Docs.
✦ The text has been successfully appended to the document "sample document 20250703".
This example demonstrates Gemini's ability to self-correct when using tools.
- Initially, Gemini tried searching Google Drive using an invalid query format (
{"query":"sample document 20250703"}
). The MCP server returned an error ("isError": true
). - Gemini recognized the failure and automatically retried the
search_file_in_google_drive
tool, this time using a valid Drive API query format ({"query":"name = 'sample document 20250703'"}
). - Once the file was found, it used
put_values_into_google_docs
to append the provided text.
Prompt
Create a new Google Document and put the following text into the Google Document.
<Text>
sample text 1
sample text 2
sample text 3
sample text 4
sample text 5
</Text>
Answer
✔ create_file_to_google_drive (gas_web_apps MCP Server) {"mimeType":"application/vnd.google-apps.document","filename":"New D…
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) {"documentId":"###","text":…
Text is appended successfully to Google Docs.
✦ I have already created a new Google Document named "New Document 2025-07-03" and put the specified text into it.
This required two sequential tools. First, create_file_to_google_drive
was used to create a new document; Gemini automatically assigned a relevant filename ("New Document 2025-07-03"). Second, put_values_into_google_docs
was used to insert the text into the newly created document ID.
This idea and the supporting script are based on "Integrating Gemini and Google Apps Script for Automated Google Slides Presentations". Ref
Prompt
Please create a 3-minute presentation. The title will be "Cooking miso soup". My name is Tanaike. The purpose of the presentation is to explain how to make delicious miso soup.
Answer
✔ generate_presentation_with_google_slides (gas_web_apps MCP Server) {"name":"Tanaike","text":"This presentation will guide …
Presentation was successfully created. The url is "https://docs.google.com/open?id=###".
✦ The presentation "Cooking misosoup" has been created. You can access it at:
https://docs.google.com/open?id=###
The following presentation is automatically generated in Google Slides.
The Gemini CLI passed the request parameters to the generate_presentation_with_google_slides
tool on the MCP server. This specific tool in Google Apps Script uses the Gemini API internally (requiring the API key mentioned in the setup) to generate the slide content and structure, then uses the Slides Service to create the presentation.
This idea and the script are adapted from "A Novel Approach to Learning: Combining Gemini with Google Apps Script for Automated Q&A". Ref
Prompt
I want to conduct a survey about favorite Japanese foods. Your mission is as follows:
* Generate a survey using Google Forms.
* Send an email to [email protected] including the published URL of the Google Form.
* The email's subject line should be "Request for a survey about your favorite Japanese foods."
* Create the email's body from the subject.
Answer
✔ generate_survey_with_google_forms (gas_web_apps MCP Server) {"title":"Favorite Japanese Foods Survey","itemList":[{"requir…
The survey was successfully generated as a Google Form. The edit URL and published URL of the form are "https://docs.google.com/forms/d/###/edit" and "https://docs.google.com/forms/d/e/#####/viewform", respectively.
✔ auto_new_draft_creation_Gmail (gas_web_apps MCP Server) {"obj":[{"body":"Request for a survey about your favorite Japanese…
A draft email was successfully created. The draft ID is "r###".
✔ send_mails_Gmail (gas_web_apps MCP Server) {"draftIds":["r###"]}
Message of "Request for a survey about your favorite Japanese foods." was correctly sent.
✦ I have successfully generated the survey and sent the email with the published URL of the Google Form to [email protected].
The following survey is automatically generated in Google Forms.
And the following email is sent to [email protected]
:
Mail title:
Request for a survey about your favorite Japanese foods.
Mail body:
Request for a survey about your favorite Japanese foods.
Here is the link to the survey: https://docs.google.com/forms/d/e/#####/viewform
This required three steps integrating Forms and Gmail:
generate_survey_with_google_forms
created the form and returned the published URL.auto_new_draft_creation_Gmail
created an email draft, incorporating the URL from step 1.send_mails_Gmail
sent the drafted email.
This idea and the script are also adapted from "A Novel Approach to Learning: Combining Gemini with Google Apps Script for Automated Q&A". Ref
Prompt
Suggest 5 questions and answers for a quiz with multiple-choice questions for learning Google Apps Script for beginners. Generate the quiz in Google Forms using the questions. The number of choices for each question is 5. The title of the quiz is "Learning Google Apps Script".
Answer
✔ generate_quiz_with_google_forms (gas_web_apps MCP Server) {"title":"Learning Google Apps Script","itemList":[{"required":t…
The quiz was successfully generated as a Google Form. The edit URL and published URL of the form are "https://docs.google.com/forms/d/###/edit" and "https://docs.google.com/forms/d/e/#####/viewform", respectively.
✦ The quiz "Learning Google Apps Script" has been generated in Google Forms.
* Edit URL: https://docs.google.com/forms/d/###/edit
* Published URL: https://docs.google.com/forms/d/e/#####/viewform
The following quiz is automatically generated in Google Forms.
Gemini generated the required questions, choices, and correct answers based on the prompt's requirements, and then structured this data into the parameters required by the generate_quiz_with_google_forms
tool, which created the Google Form.
The following samples were added on July 9, 2025.
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.
When this prompt is run, the file sample.png
is downloaded from Google Drive using the ggsrun
CLI tool.
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.
When this prompt is run, the following steps are executed:
- An image file is downloaded using
wget
. - An attempt to upload the
.webp
file withggsrun
fails. - The file is converted to the PNG format using the
convert
command. - The converted
.png
file is successfully uploaded to Google Drive.
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 ###.
When this prompt is run, the following steps are executed:
- Upload a file from the local PC to Google Drive using
ggsrun
. - Rename the uploaded file using the
rename_files_on_google_drive
tool from the MCP server. - Return the file ID of the uploaded file.
Prompt
Upload the file "sample.png" using ggsrun, create a draft email with the uploaded file as an attachment, and send the email to "[email protected]".
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":"[email protected]","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 "[email protected]".
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.
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.
This prompt executes the following steps:
- The file and folder are located by name to retrieve their IDs using the
search_file_in_google_drive
tool. - The file is moved to the destination folder using the
move_files_on_google_drive
tool.
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.
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.
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.
An image is generated using the generate_image_on_google_drive
tool from the MCP server and then downloaded using ggsrun
.
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.
In this example, a description of the website is generated using the description_web_site
tool from the MCP server.
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."
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.
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:
When this prompt is run, the following steps are executed:
- Create a new Google Spreadsheet using the
create_file_to_google_drive
tool from the MCP server. - Generate a roadmap in the new spreadsheet using the
generate_roadmap_to_google_sheets
tool. - Download the roadmap as a PDF file from Google Drive using
ggsrun
.
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 "[email protected]".
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 "[email protected]".
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.
When this prompt is run, the following steps are executed:
- A tool
description_web_site
generates a description of the web site. - A tool
create_file_to_google_drive
creates a new Google Document. - A tool
put_values_into_google_docs
puts the generated description into the created document. - A tool
generate_presentation_with_google_slides
generates a presentation to Google Slides using the title and Google Document. - A tool
auto_new_draft_creation_Gmail
creates a draft email including the URL of the Google Slides. - A tool
send_mails_Gmail
sends the email.
The following samples were added on July 10, 2025.
Prompt
Create a new Google Document and send an email to [email protected] that includes the document. Grant the user edit permission for the Google Document.
Answer
✔ create_file_to_google_drive (gas_web_apps MCP Server) {"filename":"New Google Document","mimeType":"application/vnd.google…
A file was created on the root folder. The file URL is "https://docs.google.com/document/d/###/edit?usp=drivesdk".
✔ change_permission_of_file_on_google_drive (gas_web_apps MCP Server) {"role":"editor","fileId":"###…
Permission for the file 'New Google Document' (ID: ###) was successfully updated. User '[email protected]' has been granted 'editor' access.
✔ auto_new_draft_creation_Gmail (gas_web_apps MCP Server) {"obj":[{"title":"New Google Document","to":"[email protected]",…
A draft email was successfully created. The draft ID is "r###".
✔ send_mails_Gmail (gas_web_apps MCP Server) {"draftIds":["r###"]}
Message of "New Google Document" was correctly sent.
✦ I have created a new Google Document, granted edit permission to [email protected], and sent an email to them with the
document link.
When this is run, an email including the URL of the Google Document. And, the write permission was added to the email.
The examples above demonstrate that combining the Gemini CLI with an MCP server built using Google Apps Script Web Apps enables powerful automation across Google Workspace. By leveraging Google Apps Script's inherent authorization capabilities, we can easily give Gemini access to Gmail, Calendar, Drive, Docs, Sheets, and Slides.
The samples provided represent only a small subset of what is possible. The ToolsForMCPServer
library includes many functions derived from previously developed Google Apps Script utilities. Furthermore, because the MCP server is simply a Google Apps Script project, developers can easily incorporate their own existing GAS snippets as new tools for the Gemini CLI. As this MCP server is updated with more tools, the potential for complex, AI-driven automation within the Google ecosystem becomes nearly limitless.
You might want to add your custom tools to the MCP server. At that time, please refer to the following script.
/**
* If you want to add your custom tools, please use the following script.
* This is a simple sample. Please modify the following script to your situation.
*/
function getCustomTools() {
const functions = {
params_: {
function_name1: {
description: "###",
parameters: {}
},
function_name2: {
description: "###",
parameters: {}
}
},
function_name1: (object) => { },
function_name2: (object) => { },
};
// for MCP
const itemsForMCP = [
{
"type": "initialize",
"value": {
"protocolVersion": "2024-11-05", // or "2025-03-26"
"capabilities": { "tools": { "listChanged": false } },
"serverInfo": { "name": "gas_web_apps", "version": "1.0.0" }
}
},
...Object.keys(functions.params_).map(f => (
{
"type": "tools/list",
"function": functions[f],
"value": {
name: f,
description: functions.params_[f].description,
inputSchema: functions.params_[f].parameters,
}
}))
];
// return itemsForMCP;
return itemsForMCP;
}
const apiKey = "###"; // API key for Gemini API
/**
* This function is automatically run when the MCP client accesses Web Apps.
*/
const doPost = e => main(e);
function main(eventObject) {
const m = ToolsForMCPServer;
m.apiKey = apiKey;
const object = { eventObject, items: [...m.getTools(), ...getCustomTools()] };
return new MCPApp
.mcpApp({ accessKey: "sample" })
.setServices({ lock: LockService.getScriptLock() })
.server(object);
}
-
v1.0.0 (July 3, 2025)
- Initial release.
-
v1.0.1 (July 9, 2025)
- The method name of
getServer
was changed togetTools
. But,getServer
can still be used. - The following methods were added.
- For management of Gmail
- get_attachment_files_from_Gmail
- For management of Google Drive
- rename_files_on_google_drive
- move_files_on_google_drive
- convert_mimetype_of_file_on_google_drive
- For using Gemini
- generate_roadmap_to_google_sheets
- generate_description_on_google_drive
- generate_image_on_google_drive
- summarize_file_on_google_drive
- description_web_site
- Added sample prompts and answers in README.md.
- The method name of
-
v1.0.2 (July 10, 2025)
- A tool
change_permission_of_file_on_google_drive
was added. By this, when a Google Docs files are included in Gmail, the email can be sent by giving permission to the Google Docs file.
- A tool
-
v1.0.3 (July 11, 2025)
- A tool
get_current_weather
was updated. - A new tool
get_specific_date_weather
was added.
- A tool
-
v1.0.4 (July 11, 2025)
- A function
getSheet_
was updated.
- A function
-
v1.0.5 (July 16, 2025)
- A new tool
search_values_from_google_sheets
was added.
- A new tool
-
v1.0.6 (July 17, 2025)
- The following 6 new tools were added.
- get_google_doc_object_using_docs_api
- manage_google_docs_using_docs_api
- get_google_sheet_object_using_sheets_api
- manage_google_sheets_using_sheets_api
- get_google_slides_object_using_slides_api
- manage_google_slides_using_slides_api
-
v1.0.7 (July 19, 2025)
- Added a
getToolList
method for retrieving all current tools in the library. - Tools can be filtered using
enables
ordisables
as an array argument for thegetTools
method. Ifenables
is used, only the tools specified in theenables
array will be used. Ifdisables
is used, all tools except those specified in thedisables
array will be used. If neitherenables
nordisables
is used, all tools will be used.
- Added a