Skip to main content
Glama

Generate Trigger Code

generate_trigger_code
Read-onlyIdempotent

Generates Apps Script code for creating triggers in Google Workspace. Specify trigger type, function name, and schedule to produce executable code.

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
trigger_typeYesType 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_nameYesThe function to run when trigger fires (e.g., "sendDailyReport")
scheduleNoSchedule 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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true, confirming no side effects. The description adds context that the tool generates code (not modifies resources) and explains the underlying reason (API limitation). No contradiction with annotations.

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

Conciseness5/5

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

The description is two sentences that efficiently state the purpose and rationale. No unnecessary words or repetition. Front-loaded with the core action.

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?

The description covers the why and what, but could briefly mention the expected output (generated code) and next steps (e.g., copy into Apps Script). However, since output schema exists, the missing guidance is minor.

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

Parameters3/5

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

Schema description coverage is 100% with detailed parameter descriptions (including enums and conditional requirements). The tool description does not add any extra information about parameters beyond what is already in the schema.

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 clearly states the tool generates Apps Script code for creating triggers, distinguishing it from related tools like run_script_function which execute code, or create_script_project which manages projects. It explains the specific context where the API cannot create triggers directly.

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

Usage Guidelines4/5

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

The description explains when to use the tool: when the Apps Script API limitation prevents direct trigger creation. However, it does not explicitly mention when not to use it or suggest alternatives (e.g., if you are already in Apps Script or need to execute code, use run_script_function).

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chadvdwww-hash/worksuite-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server