メインコンテンツにスキップ

ToolsForMCPServer

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.

AI Summary

ToolsForMCPServer

Provides GAS tools for MCP servers to integrate Gemini CLI with Google Workspace services.

Target Users

Intermediate to advanced GAS developers building MCP servers for Gemini CLI automation with Google Workspace.

Problems Solved

Resolves authentication and tool provisioning complexities for MCP servers using Google Workspace APIs in Gemini CLI.

Script ID

  1. In GAS Editor: Click "Libraries +" → Paste into "Script ID" field → Click "Look up"
  2. "ToolsForMCPServer" will appear in the search results
  3. Select the latest version (highest number) from "Version" dropdown
  4. Click "Add"

Tags

Main Features
1
160+ Pre-built Tools

Offers 160+ tools for Gmail, Drive, Calendar, Classroom, etc., enabling quick Google Workspace automation.

2
Easy Library Install

Install as GAS library and set up MCP server instantly in main function with enable/disable filtering.

3
Seamless API Auth

Automates Google API auth via GAS Web Apps for simplified access from Gemini CLI.

Examples

Main Functions

FunctionDescription
ToolsForMCPServer.getTools()Retrieves list of available MCP tools
ToolsForMCPServer.getToolList()Gets complete list of all tools
ToolsForMCPServer.getTools({enables})Enables specific tools only

Examples

Basic MCP Server Setup
/**
 * 基本MCPサーバー構築
 * ・APIキー設定: m.apiKey = apiKey;
 * ・ツール取得: m.getTools();
 * ・MCPサーバー実行: new MCPApp.mcpApp(...).server(object);
 */
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);
}

Show All Tools
/**
 * 全ツール一覧表示
 * ・ライブラリ初期化: const m = ToolsForMCPServer;
 * ・ツールリスト取得: m.getToolList();
 * ・ログ出力: console.log(res);
 */
function showAlltools() {
  const res = ToolsForMCPServer.getToolList();
  console.log(res);
}

Filter Tools
/**
 * ツールフィルタリング
 * ・有効ツール指定: const enables = ["get_exchange_rate"];
 * ・フィルタ適用: m.getTools({ enables });
 * ・サーバー実行: new MCPApp.mcpApp(...).server(object);
 */
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);
}

Sample Code

Post a Sample

No sample codes for this library yet

Be the first to post a sample!

Post a Sample