Skip to main content
Glama

generate_trigger_code

Generate Apps Script code to create automated triggers for time-based events, document actions, or form submissions when the Apps Script API cannot create them directly.

Instructions

Generate 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: Apps Script code to create the trigger. User should add this to their script and run the setup function once to install the trigger.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
trigger_typeYes
function_nameYes
scheduleNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
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 of behavioral disclosure. It clearly explains that this tool generates code rather than executing actions directly ('Generate Apps Script code'), describes the output ('Apps Script code to create the trigger'), and provides important usage instructions ('User should add this to their script and run the setup function once to install the trigger'). However, it doesn't mention potential limitations like rate limits, authentication requirements, or error conditions.

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 well-structured and appropriately sized. It starts with the core purpose, provides necessary context about API limitations, then details parameters in a clear format, and concludes with return value and usage instructions. Every sentence serves a specific purpose with no wasted words.

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

Completeness5/5

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

Given the tool's complexity (generating executable code), 0% schema description coverage, no annotations, but with an output schema present, the description provides excellent completeness. It explains the tool's purpose, API constraints, detailed parameter semantics, return value format, and post-generation usage instructions. The presence of an output schema means the description doesn't need to detail return structure, allowing it to focus on conceptual understanding.

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?

With 0% schema description coverage, the description fully compensates by providing comprehensive parameter documentation. It clearly explains all three parameters (trigger_type, function_name, schedule) with detailed semantics, including enumerated values for trigger_type, format requirements for schedule based on trigger_type, and when schedule is not needed. This adds significant value beyond the bare 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's purpose: 'Generate Apps Script code for creating triggers.' It specifies the exact action (generate code) and resource (Apps Script triggers), and distinguishes itself from siblings by explaining the unique constraint that 'Apps Script API cannot create triggers directly - they must be created from within Apps Script itself.' This provides clear differentiation from other tools that might directly manipulate resources.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'The Apps Script API cannot create triggers directly... This tool generates the code you need.' It provides clear context about the limitation of the API and positions this tool as the solution for creating triggers, effectively distinguishing it from any potential alternatives that might attempt direct trigger creation.

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/sam-ent/appscript-mcp'

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