Skip to main content
Glama

Run a script function

run_function
Destructive

Execute a named function in a Google Apps Script project, supply JSON-serializable arguments, and retrieve the result or the script's stack trace on failure.

Instructions

Runs a named function in the script and returns { done, result } — or, when the script itself throws, { done, script_error: { type, message, stack } } with the Apps Script stack trace (this is a script bug, not a transport error; do not blindly retry, the function may have side effects). HARD PREREQUISITES the API enforces: (1) the script must have an API-executable deployment (Deploy > New deployment > API executable, or a manifest with executionApi); (2) this server's OAuth client must belong to the SAME Google Cloud project as the script (script editor > Project Settings > change the GCP project number); (3) the OAuth token must carry every scope the script itself uses (listed in the editor under Project Settings > Show "appsscript.json") — otherwise the call fails with 403 PERMISSION_DENIED or 404. parameters are positional and must be JSON-serializable (no Apps Script objects like Document or Range). dev_mode=true runs the latest saved code instead of the deployed version — owner only. Executions time out after 6 minutes on the Apps Script side.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dev_modeNoRun the latest saved code instead of the deployed version (script owner only; default false).
script_idYesThe script project id — from the Apps Script editor URL (script.google.com/home/projects/<scriptId>/edit) or from create_project output. For standalone projects it doubles as the Drive file id.
parametersNoPositional arguments, JSON-serializable primitives/arrays/objects only.
function_nameYesThe name of the function to run, without parentheses.
Behavior5/5

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

The description goes well beyond the annotations by explaining the script_error return shape, distinguishing script bugs from transport errors, warning against blind retries due to possible side effects, spelling out OAuth/GCP prerequisites, and disclosing the timeout. The destructiveHint annotation is consistent with the side-effect warning.

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 description is long but every sentence carries important operational information. It is front-loaded with the core action and return type, though the dense paragraph structure and heavy parentheticals make it slightly harder to scan.

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?

For a remote-execution tool with no output schema, the description is exceptionally complete: it covers return shapes, error taxonomy, side effects, prerequisites, permission failures, parameter constraints, dev_mode semantics, and timeout. An agent has enough information to call this correctly and diagnose failures.

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%, so the description only needs to add marginal meaning. It mostly restates what the schema already says about parameters being positional, JSON-serializable, and dev_mode being owner-only, rather than introducing new parameter-level details.

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 opens with a specific verb and resource: 'Runs a named function in the script' and clarifies the return contract ({ done, result } or { done, script_error }). This clearly differentiates run_function from the project-management and setup-related sibling tools.

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 gives clear operational context: hard prerequisites, dev_mode owner-only behavior, positional JSON-serializable parameters, and the 6-minute timeout. It does not explicitly name alternatives or state when not to use this tool, but the context is strong enough to guide correct selection.

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/A1-x-Tech/mcp-google-apps-script'

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