tanaike - Google Apps Script, Gemini API, and Developer Tips

The Thinker

Consolidating Generative AI Protocols: A Single Server Solution for MCP and A2A

Gists

Abstract

A new unified Google Apps Script now deploys both Model Context Protocol (MCP) and Agent2Agent (A2A) networks as a single server, streamlining AI model integration for Google Workspace users.

Introduction

The rapid growth of generative AI has led to increasing integration between AI models, exemplified by protocols like the Model Context Protocol (MCP) and Agent2Agent (A2A) Protocol. Recently, I released MCPApp and A2AApp, which establish the MCP and A2A networks using Google Apps Script. Ref and Ref This approach offers significant advantages for users of Google Workspace and Google APIs, as it enables seamless authorization and integration of these resources directly within the applications.

Growing Image Generation with Gemini API: Python and Node.js Now Supported

Gists

Abstract

This article announces that the Gemini API’s Python client library now supports “growing image” generation, a feature previously unavailable. Sample scripts for Python and Node.js are provided to demonstrate this new capability.

Introduction

I recently published an article, “Generate Growing Images using Gemini API,” which detailed a method for progressively generating images. At the time of publication, the official Python client library for the Gemini API lacked the necessary functionality to fully implement this feature, preventing Python users from easily replicating the “growing image” effect.

Gmail Processing using MCP Network Powered by Google Apps Script

Gists

Abstract

This report details an MCP network using Google Apps Script for both server and client, enabling automated, secure Gmail processing to boost efficiency.

Introduction

Recently, I published a report titled “Building Model Context Protocol (MCP) Server with Google Apps Script,” which you can find here. In that initial report, I demonstrated the feasibility of creating an MCP server using Google Apps Script, with Claude Desktop serving as the client.

Text-To-Speech (TTS) using Gemini API with Google Apps Script

Gists

Description

This script provides a simple example for generating Text-To-Speech (TTS) using the Gemini API within Google Apps Script. The Gemini API generates audio data in the audio/L16;codec=pcm;rate=24000 format, which is not directly playable. Since there’s no built-in method to convert this to a standard audio/wav format, this sample script includes a custom function to handle the conversion.

Limitations and Considerations

  • The provided convertL16ToWav_ function is specifically designed for the audio/L16;codec=pcm;rate=24000 MIME type. Using it with other audio formats will result in an error.
  • The script uses a hardcoded WAV header. This header assumes specific audio parameters (e.g., sample rate, bit depth, number of channels) that match the Gemini API’s output for this format. If the Gemini API’s output format changes, this header might need adjustment.

Sample Script

Before running, replace "###" with your actual Gemini API key in the myFunction.

Importance of Time Information in Gemini and Current Time Handling

Gists

Abstract

This report investigates how Gemini handles current time information, particularly when using the Gemini API. We found that while the Gemini web interface knows the current time, the Gemini API does not inherently. Therefore, applications must explicitly provide current time information in API calls for accurate time-sensitive responses.

Introduction

The rapidly advancing field of generative AI is enabling increasingly complex tasks, particularly through the use of open protocols like the Model Context Protocol (MCP) and Agent2Agent (A2A) Protocol. These protocols facilitate sophisticated operations that often require accurate and dynamic information, including time-sensitive data. For instance, applications that manage schedules or coordinate events critically depend on precise time information.

Automating Straight to Smart Quote Conversion in Google Docs

Gists

Abstract

For extensive Google Docs, manually converting straight to smart quotes is inefficient. This report offers an automated solution using Google Apps Script, saving time and effort.

Description

You might find yourself needing to convert straight quotes (both single and double) to smart quotes in Google Docs. For small documents with a limited number of quotes, this can be done manually with minimal effort. However, when dealing with extensive documents and numerous quotes, the manual process becomes time-consuming and inefficient. This report presents a solution to automate this conversion using Google Apps Script, significantly reducing the processing cost for larger projects.