Gists

Abstract
This article demonstrates integrating Google Maps with natural language using the Gemini CLI and an MCP server. This powerful combination allows users to automate complex location-based tasks, such as route planning and information retrieval, through simple, intuitive text-based prompts.
Introduction
The Gemini CLI, when paired with Model Context Protocol (MCP) servers, is a powerful tool for integrating various applications with natural language. When the MCP servers are built using Google Apps Script Web Apps, it becomes easy to integrate Google Workspace and other Google APIs with seamless authorization. This concept has been explored in several articles, which you can find here: Ref, Ref, Ref, Ref, Ref, Ref, Ref. This article introduces the integration of Google Maps and natural language using the Gemini CLI with an MCP server.
This sample script is for searching route between place A and B and embedding a map by custom function on Spreadsheet.
I think that this method is one of various ideas.
Problem
When the map is embedded to a cell on spreadsheet as an image, the function =IMAGE() is suitable for this situation. However, Class Maps, setFormula() for importing =IMAGE() and DriveApp.createFile() for creating images from maps also cannot be used for custom functions.
This sample script embeds a map to a cell using custom function on Spreadsheet.
I think that this method is one of various ideas.
Problem
When the map is embeded to a cell on spreadsheet as an image, the function =IMAGE() is suitable for this situation. However, setFormula() for importing =IMAGE() and DriveApp.createFile() for creating images from maps also cannot be used for custom functions.
Solution
In order to avoid these limitations, I used Web Apps. From previous research, it has been found that Web Apps can avoid various limitations. Also in the case of this situation, Web Apps could avoid the above limitations.