Google Workspace / 17 tools / REST v1

Apps Script,
from any agent.

Read code, push changes and update a deployment through Google's API. Keep the web-app URL your users already know.

No local clasp installation. Broker-owned Google credentials.

Verification: examples below use mock fixtures. Real Google integration awaits an authorized scratch-project test. Writes require explicit server enablement.

Publish without changing the link

content_get → content_update (upsert) → version_create → deployment_update → script_processes_list

Use the existing deployment ID. A new deployment creates a new URL. Upsert preserves omitted files; full replacement deletes them. Concurrent editor changes can race the read-merge-write operation.

Connect once, then call

  1. Enable Apps Script API in your Google Cloud project and at Google Apps Script user settings.
  2. Connect broker provider google-appsscript for the intended agent. Request script.projects, script.deployments, script.processes, script.metrics and optionally drive.file for app-authorized-file search.
  3. Attach https://appsscriptmcp.agenticledger.ai/mcp with a Google Bearer token, executor-stamped broker principal (HMAC required only when configured), or private persistent caller key. Keep credentials in the platform's secure connection flow.
  4. The approved Railway production profile enables writes with APPS_SCRIPT_ENABLE_WRITES=true; ordinary local startup stays read-only. Verify /health before publishing and first test a scratch project.

Running functions: an API-executable deployment must share the OAuth client's standard GCP project, and the token needs every scope used by the script. Drive search is limited to app-authorized standalone files with drive.file; a 403 returns search_unavailable and you can continue using a known scriptId. Process history exposes statuses and timing; full logs remain in Google Cloud Logging / Apps Script Executions.

Reconnect Google to grant all four script scopes; refreshing an old token does not expand consent. The default broker provider omits Drive scopes. Optional search may return search_unavailable; project operations work directly with a scriptId.

Tool reference

17 tools
READ

project_get

Read project metadata. OAuth: https://www.googleapis.com/auth/script.projects or https://www.googleapis.com/auth/script.projects.readonly.

Example arguments

{
  "scriptId": "scratch-script"
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    }
  },
  "required": [
    "scriptId"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "scriptId": "scratch-script",
    "title": "Mock scratch"
  }
}
READ

content_get

Pull all files at HEAD or an immutable version; returns contentHash for conflict checks. OAuth: https://www.googleapis.com/auth/script.projects or https://www.googleapis.com/auth/script.projects.readonly.

Example arguments

{
  "scriptId": "scratch-script"
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "versionNumber": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 2147483647
    }
  },
  "required": [
    "scriptId"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "scriptId": "scratch-script",
    "files": [
      {
        "name": "appsscript",
        "type": "JSON",
        "source": "{\"timeZone\":\"Etc/UTC\",\"runtimeVersion\":\"V8\"}"
      },
      {
        "name": "Code",
        "type": "SERVER_JS",
        "source": "function ping() { return \"pong\"; }"
      }
    ],
    "contentHash": "afa4051ce5cdf3dfa889368482814bc25135ae3a6ed78dd2f5d18721570019cb"
  }
}
READ

versions_list

List immutable versions. Use nextPageToken for the next bounded page. OAuth: https://www.googleapis.com/auth/script.projects or https://www.googleapis.com/auth/script.projects.readonly.

Example arguments

{
  "scriptId": "scratch-script",
  "pageSize": 20
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "pageSize": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "pageToken": {
      "type": "string",
      "maxLength": 4096
    }
  },
  "required": [
    "scriptId"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "versions": [
      {
        "versionNumber": 1,
        "description": "Mock version"
      }
    ]
  }
}
READ

version_get

Read one immutable version. OAuth: https://www.googleapis.com/auth/script.projects or https://www.googleapis.com/auth/script.projects.readonly.

Example arguments

{
  "scriptId": "scratch-script",
  "versionNumber": 1
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "versionNumber": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 2147483647
    }
  },
  "required": [
    "scriptId",
    "versionNumber"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "versionNumber": 1
  }
}
READ

deployments_list

List deployments and entry-point URLs. OAuth: https://www.googleapis.com/auth/script.deployments or https://www.googleapis.com/auth/script.deployments.readonly.

Example arguments

{
  "scriptId": "scratch-script"
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "pageSize": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "pageToken": {
      "type": "string",
      "maxLength": 4096
    }
  },
  "required": [
    "scriptId"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "deployments": [
      {
        "deploymentId": "scratch-deployment",
        "deploymentConfig": {
          "versionNumber": 1,
          "manifestFileName": "appsscript"
        }
      }
    ]
  }
}
READ

deployment_get

Read a deployment and its entry points. OAuth: https://www.googleapis.com/auth/script.deployments or https://www.googleapis.com/auth/script.deployments.readonly.

Example arguments

{
  "scriptId": "scratch-script",
  "deploymentId": "scratch-deployment"
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "deploymentId": {
      "$ref": "#/properties/scriptId"
    }
  },
  "required": [
    "scriptId",
    "deploymentId"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "deploymentId": "scratch-deployment",
    "deploymentConfig": {
      "scriptId": "scratch-script",
      "versionNumber": 1,
      "manifestFileName": "appsscript",
      "description": "Mock"
    },
    "entryPoints": [
      {
        "entryPointType": "WEB_APP",
        "webApp": {
          "url": "https://script.google.com/macros/s/scratch-deployment/exec"
        }
      }
    ]
  }
}
READ

processes_list

Execution history across projects; statuses include FAILED. This is metadata, not console logs or stack traces. OAuth: https://www.googleapis.com/auth/script.processes.

Example arguments

{
  "filter": {
    "statuses": [
      "FAILED"
    ]
  }
}

Input schema

{
  "type": "object",
  "properties": {
    "pageSize": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "pageToken": {
      "type": "string",
      "maxLength": 4096
    },
    "filter": {
      "type": "object",
      "properties": {
        "deploymentId": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,256}$"
        },
        "functionName": {
          "type": "string",
          "maxLength": 1024
        },
        "startTime": {
          "type": "string",
          "format": "date-time"
        },
        "endTime": {
          "type": "string",
          "format": "date-time"
        },
        "statuses": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "RUNNING",
              "PAUSED",
              "COMPLETED",
              "CANCELED",
              "FAILED",
              "TIMED_OUT",
              "UNKNOWN",
              "DELAYED"
            ]
          },
          "maxItems": 8
        },
        "scriptId": {
          "$ref": "#/properties/filter/properties/deploymentId"
        },
        "projectName": {
          "$ref": "#/properties/filter/properties/functionName"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "processes": [
      {
        "functionName": "ping",
        "processStatus": "COMPLETED",
        "processType": "EXECUTION_API",
        "duration": "0.1s"
      }
    ]
  }
}
READ

script_processes_list

Execution history for one script; metadata and error status, not full Cloud Logging messages. OAuth: https://www.googleapis.com/auth/script.processes.

Example arguments

{
  "scriptId": "scratch-script",
  "filter": {
    "statuses": [
      "FAILED"
    ]
  }
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "pageSize": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "pageToken": {
      "type": "string",
      "maxLength": 4096
    },
    "filter": {
      "type": "object",
      "properties": {
        "deploymentId": {
          "$ref": "#/properties/scriptId"
        },
        "functionName": {
          "type": "string",
          "maxLength": 1024
        },
        "startTime": {
          "type": "string",
          "format": "date-time"
        },
        "endTime": {
          "type": "string",
          "format": "date-time"
        },
        "statuses": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "RUNNING",
              "PAUSED",
              "COMPLETED",
              "CANCELED",
              "FAILED",
              "TIMED_OUT",
              "UNKNOWN",
              "DELAYED"
            ]
          },
          "maxItems": 8
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "scriptId"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "processes": [
      {
        "functionName": "ping",
        "processStatus": "COMPLETED",
        "processType": "EXECUTION_API",
        "duration": "0.1s"
      }
    ]
  }
}
READ

metrics_get

Read execution, failed-execution and active-user counts (not latency). OAuth: https://www.googleapis.com/auth/script.metrics.

Example arguments

{
  "scriptId": "scratch-script",
  "metricsGranularity": "DAILY"
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "metricsGranularity": {
      "type": "string",
      "enum": [
        "WEEKLY",
        "DAILY"
      ],
      "default": "DAILY"
    },
    "deploymentId": {
      "$ref": "#/properties/scriptId"
    }
  },
  "required": [
    "scriptId"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "metricsGranularity": "DAILY",
    "totalExecutions": [
      {
        "startTime": "2026-01-01T00:00:00Z",
        "endTime": "2026-01-02T00:00:00Z",
        "value": "1"
      }
    ]
  }
}
READ

projects_search

Search standalone Apps Script files in Drive; container-bound scripts are not listed. drive.file only sees app-authorized files; a 403 returns search_unavailable with direct-scriptId guidance. OAuth: https://www.googleapis.com/auth/drive.readonly or https://www.googleapis.com/auth/drive.file.

Example arguments

{
  "nameContains": "Scratch"
}

Input schema

{
  "type": "object",
  "properties": {
    "pageSize": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "pageToken": {
      "type": "string",
      "maxLength": 4096
    },
    "nameContains": {
      "type": "string",
      "maxLength": 200
    }
  },
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "files": [
      {
        "id": "scratch-script",
        "name": "Mock scratch"
      }
    ]
  }
}
WRITE

project_create

Create a standalone project, or bind it to a Sheet/Doc/Slides/Form with parentId. Creates a remote resource. OAuth: https://www.googleapis.com/auth/script.projects. Requires APPS_SCRIPT_ENABLE_WRITES=true.

Example arguments

{
  "title": "MCP scratch"
}

Input schema

{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "parentId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    }
  },
  "required": [
    "title"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "scriptId": "scratch-script",
    "title": "MCP scratch"
  }
}
WRITE

content_update

Push files. Default upsert reads HEAD, merges by name and type and preserves omitted files. replace DELETES all omitted files and needs confirmReplace=true. Both write the complete file set; concurrent editor changes can race even with expectedContentHash. HEAD changes affect triggers immediately. OAuth: https://www.googleapis.com/auth/script.projects. Requires APPS_SCRIPT_ENABLE_WRITES=true.

Example arguments

{
  "scriptId": "scratch-script",
  "mode": "upsert",
  "files": [
    {
      "name": "Code",
      "type": "SERVER_JS",
      "source": "function ping() { return \"pong\"; }"
    }
  ]
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "files": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "SERVER_JS",
                  "HTML",
                  "JSON"
                ]
              },
              "source": {
                "type": "string",
                "maxLength": 4194304
              }
            },
            "required": [
              "name",
              "type",
              "source"
            ],
            "additionalProperties": false
          },
          "minItems": 1,
          "maxItems": 200
        },
        {
          "allOf": [
            {
              "type": "string",
              "maxLength": 8388608
            },
            {
              "$ref": "#/properties/files/anyOf/0"
            }
          ]
        }
      ]
    },
    "mode": {
      "type": "string",
      "enum": [
        "upsert",
        "replace"
      ],
      "default": "upsert"
    },
    "confirmReplace": {
      "type": "boolean"
    },
    "expectedContentHash": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    }
  },
  "required": [
    "scriptId",
    "files"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "scriptId": "scratch-script",
    "files": [
      {
        "name": "appsscript",
        "type": "JSON",
        "source": "{\"timeZone\":\"Etc/UTC\",\"runtimeVersion\":\"V8\"}"
      },
      {
        "name": "Code",
        "type": "SERVER_JS",
        "source": "function ping() { return \"pong\"; }"
      }
    ]
  }
}
WRITE

version_create

Snapshot current HEAD into a new immutable version. OAuth: https://www.googleapis.com/auth/script.projects. Requires APPS_SCRIPT_ENABLE_WRITES=true.

Example arguments

{
  "scriptId": "scratch-script",
  "description": "Scratch release"
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "description": {
      "type": "string",
      "maxLength": 1024
    }
  },
  "required": [
    "scriptId"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "versionNumber": 1,
    "description": "Scratch release"
  }
}
WRITE

deployment_create

Create a NEW deployment URL from a saved version. For an existing web app use deployment_update to retain /exec URL. OAuth: https://www.googleapis.com/auth/script.deployments. Requires APPS_SCRIPT_ENABLE_WRITES=true.

Example arguments

{
  "scriptId": "scratch-script",
  "versionNumber": 1
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "versionNumber": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 2147483647
    },
    "description": {
      "type": "string",
      "maxLength": 1024
    },
    "manifestFileName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "default": "appsscript"
    }
  },
  "required": [
    "scriptId",
    "versionNumber"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "deploymentId": "scratch-deployment",
    "deploymentConfig": {
      "versionNumber": 1,
      "manifestFileName": "appsscript"
    }
  }
}
WRITE

deployment_update

Point an EXISTING deployment at a saved version; retains deployment ID and web-app /exec URL. Reads and preserves omitted description/manifest fields. OAuth: https://www.googleapis.com/auth/script.deployments. Requires APPS_SCRIPT_ENABLE_WRITES=true.

Example arguments

{
  "scriptId": "scratch-script",
  "deploymentId": "scratch-deployment",
  "versionNumber": 2
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "deploymentId": {
      "$ref": "#/properties/scriptId"
    },
    "versionNumber": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 2147483647
    },
    "description": {
      "type": "string",
      "maxLength": 1024
    },
    "manifestFileName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    }
  },
  "required": [
    "scriptId",
    "deploymentId",
    "versionNumber"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "deploymentId": "scratch-deployment",
    "deploymentConfig": {
      "scriptId": "scratch-script",
      "versionNumber": 2,
      "description": "Mock",
      "manifestFileName": "appsscript"
    },
    "entryPoints": [
      {
        "entryPointType": "WEB_APP",
        "webApp": {
          "url": "https://script.google.com/macros/s/scratch-deployment/exec"
        }
      }
    ]
  }
}
WRITE

deployment_delete

Delete a deployment; its URL stops working. Requires confirmDelete=true. OAuth: https://www.googleapis.com/auth/script.deployments. Requires APPS_SCRIPT_ENABLE_WRITES=true.

Example arguments

{
  "scriptId": "scratch-script",
  "deploymentId": "scratch-deployment",
  "confirmDelete": true
}

Input schema

{
  "type": "object",
  "properties": {
    "scriptId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$"
    },
    "deploymentId": {
      "$ref": "#/properties/scriptId"
    },
    "confirmDelete": {
      "type": "boolean",
      "const": true
    }
  },
  "required": [
    "scriptId",
    "deploymentId",
    "confirmDelete"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {}
}
WRITE

script_run

Run a function using deploymentId (API-executable deployment ID, not project ID); may change data. Legacy scriptId is an alias for that deployment ID. Requires the SAME standard GCP project as the OAuth client; token must cover ALL script scopes. No service accounts. devMode is for the script owner. A run can return Operation.error despite HTTP 200. OAuth: All OAuth scopes declared/used by the target script (no universal script.run scope). Requires APPS_SCRIPT_ENABLE_WRITES=true.

Example arguments

{
  "deploymentId": "scratch-api-deployment",
  "functionName": "ping"
}

Input schema

{
  "type": "object",
  "properties": {
    "deploymentId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,256}$",
      "description": "API-executable deployment ID from Deploy > Manage deployments; required unless legacy scriptId alias is supplied"
    },
    "scriptId": {
      "$ref": "#/properties/deploymentId",
      "description": "Deprecated alias for deploymentId; use the API-executable deployment ID, not the project ID"
    },
    "functionName": {
      "type": "string",
      "maxLength": 256,
      "pattern": "^[A-Za-z_$][A-Za-z0-9_$]*(?:\\.[A-Za-z_$][A-Za-z0-9_$]*)*$"
    },
    "parameters": {
      "anyOf": [
        {
          "type": "array",
          "items": {},
          "maxItems": 100
        },
        {
          "allOf": [
            {
              "type": "string",
              "maxLength": 1048576
            },
            {
              "$ref": "#/properties/parameters/anyOf/0"
            }
          ]
        }
      ]
    },
    "devMode": {
      "type": "boolean",
      "default": false
    }
  },
  "required": [
    "functionName"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Mock response — not live data

{
  "mode": "mock",
  "data": {
    "done": true,
    "response": {
      "result": "pong"
    }
  }
}

Enter Access Code

Enter your access code to unlock source code and GitHub links.

Invalid access code. Try again.
Unlocked!