Skip to main content
Glama

script.scripts.run

Executes a specified function in an Apps Script project headlessly and returns its response, surfacing script-side failures as tool errors.

Instructions

Executes a function in an Apps Script project (Apps Script API script.run). The script runs headlessly with the scopes its manifest declares — review them before calling: arbitrary script code executes with your authorization. Returns the script function's response (OPS_ERROR / ops for failures); script-side failures come back as tool errors, not dead servers. Prefer script processes list to observe running executions and script projects get to read a project's source before running it [HTTP POST] — creates or triggers a change; refused under --readonly safety profiles. Returns the API's response resource as JSON — request body is a JSON ExecutionRequest object accepting devMode, function, parameters, sessionState; pass it via params or whole via body_file

Input Schema

NameRequiredDescriptionDefault
queryNoExtra KEY=VALUE query pairs for endpoints whose parameters Discovery does not describe.
paramsNoParameter map merged into the request; typed parameters win.
dry_runNoReturn the request that would be sent, without sending it.
scriptIdYes[URL path segment] The script ID of the script to be executed. Find the script ID on the **Project settings** page under "IDs." As multiple executable APIs can be deployed in new
body_fileNoRead the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON ExecutionRequest object.
request_bodyNoRequest body of type ExecutionRequest: pass it via `params` (merged into the built body) or whole via `body_file`.

Output Schema

NameRequiredDescriptionDefault
doneNo
errorNo
responseNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / body_file / description
      Previous value: -"Read the request body from this file ('-' for stdin) instead of building one from the parameters."New value: +"Read the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON ExecutionRequest object."
    • addedInput schema / properties / request_body
      Added value: +{
      +  "description": "Request body of type ExecutionRequest: pass it via `params` (merged into the built body) or whole via `body_file`.",
      +  "properties": {
      +    "devMode": {
      +      "type": "boolean"
      +    },
      +    "function": {
      +      "type": "string"
      +    },
      +    "parameters": {
      +      "items": {
      +        "type": "any"
      +      },
      +      "type": "array"
      +    },
      +    "sessionState": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed2 schema fields changed
    • changedInput schema / properties / scriptId / description
      Previous value: -"The script ID of the script to be executed. Find the script ID on the **Project settings** page under \"IDs.\" As multiple executable APIs can be deployed in new "New value: +"[URL path segment] The script ID of the script to be executed. Find the script ID on the **Project settings** page under \"IDs.\" As multiple executable APIs can be deployed in new "
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "done": {
      +      "type": "boolean"
      +    },
      +    "error": {
      +      "properties": {
      +        "code": {
      +          "type": "integer"
      +        },
      +        "details": {
      +          "items": {
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "message": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "response": {
      +      "type": "object"
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does: it discloses that arbitrary script code runs headlessly under the manifest's scopes with the caller's authorization, that this creates or triggers a change, that script-side failures return as tool errors rather than dead servers, and that readonly profiles refuse it. This is materially more than a restatement of the name.

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

Conciseness3/5

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

Content is front-loaded and every clause carries real information, but it is delivered as one dense run-on paragraph with inline bracketed asides ('[HTTP POST]') that interrupt flow. It would read better split into purpose / preconditions / alternatives / request-body sections.

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?

An output schema exists, so return-shape explanation is not strictly needed, yet the description still states failures surface as tool errors — useful. For a mutation tool that executes arbitrary code, almost everything an agent needs is present; only the per-field meaning of the ExecutionRequest sub-properties is left to the schema.

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

Parameters4/5

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

Schema coverage is already 100%, so the baseline is 3. The description still adds value by naming the ExecutionRequest fields (devMode, function, parameters, sessionState) and explaining the two delivery paths — merged into the built body via `params` or supplied whole via `body_file`. It stops short of explaining what each field does (e.g., devMode semantics).

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?

States a specific verb and resource ('Executes a function in an Apps Script project') and pins it to the underlying API call (script.run). It also names the sibling tools it is not (script.processes.list for observing runs, script.projects.get for reading source), so an agent can route without opening any schema.

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?

Explicit guidance: review the manifest scopes before calling, prefer `script processes list` to observe executions and `script projects get` to read source before running. It also flags the condition under which the call is refused (readonly safety profiles), which is a hard precondition an agent must know.

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