Skip to main content
Glama
tom275275

Google Workspace MCP Server

by tom275275

generate_trigger_code

Generate Apps Script trigger code for time-based or event-driven automation. Get ready-to-use code for scheduled runs, document opens, edits, form submissions, and content changes.

Instructions

Generates Apps Script code for creating triggers.

The Apps Script API cannot create triggers directly - they must be created from within Apps Script itself. This tool generates the code you need.

Args: trigger_type: Type of trigger. One of: - "time_minutes" (run every N minutes: 1, 5, 10, 15, 30) - "time_hours" (run every N hours: 1, 2, 4, 6, 8, 12) - "time_daily" (run daily at a specific hour: 0-23) - "time_weekly" (run weekly on a specific day) - "on_open" (simple trigger - runs when document opens) - "on_edit" (simple trigger - runs when user edits) - "on_form_submit" (runs when form is submitted) - "on_change" (runs when content changes)

function_name: The function to run when trigger fires (e.g., "sendDailyReport")

schedule: Schedule details (depends on trigger_type):
          - For time_minutes: "1", "5", "10", "15", or "30"
          - For time_hours: "1", "2", "4", "6", "8", or "12"
          - For time_daily: hour as "0"-"23" (e.g., "9" for 9am)
          - For time_weekly: "MONDAY", "TUESDAY", etc.
          - For simple triggers (on_open, on_edit): not needed

Returns: str: Apps Script code to create the trigger

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scheduleNo
trigger_typeYes
function_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.14.3

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and handles it well. It discloses the key behavioral trait an agent could easily get wrong: the tool does not create a trigger, it returns code. It also documents edge-case behavior, e.g., simple triggers (on_open, on_edit) do not need a schedule. Minor omissions are auth requirements and what the generated code looks like, but the non-executing behavior is explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The one-sentence purpose is front-loaded, and the Args/Returns structure mirrors the schema for easy scanning. Every section earns its place given the 0% schema coverage. Slight redundancy exists — trigger types are enumerated in the trigger_type list and then repeated in the schedule bullets — so a consolidated table would be tighter, but the length is justified.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 3-param code-generation tool with an output schema, the description covers the non-obvious behavioral constraint, all valid parameter values, and per-type schedule rules. The return type is stated and also captured by the output schema. Gaps are minor: no example of the generated code and no statement about whether auth is needed, though as pure code generation this is low-risk.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must fully document the parameters, and it does. trigger_type enumerates all eight valid values with one-line explanations; schedule gives per-type valid choices with concrete formats ('0'-'23', 'MONDAY', '1'-'30'); function_name includes a real example ('sendDailyReport'). This goes far beyond the bare schema, which only defines types and a default.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Generates Apps Script code for creating triggers.' It also explains the critical distinction — the Apps Script API cannot create triggers directly, so this tool produces the code instead. This clearly separates it from sibling tools like run_script_function or update_script_content, which execute or modify actual script content.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The rationale ('The Apps Script API cannot create triggers directly - they must be created from within Apps Script itself') clearly implies the use case: whenever a trigger must be set up through the API, this tool is the entry point. However, it never names alternatives or says when not to use it, and the sibling list contains closely related tools (create_script_project, update_script_content, run_script_function) that receive no routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools