run_script
Run JavaScript with full Cloud Script API access (reads, writes, sending, HTTP requests) — use this for bulk changes that would otherwise take many individual API calls, such as importing or cleaning up many records. Write the code exactly as described for run_analysis_script (same sandbox, limits, and documentation references). Use batch methods (e.g. importContacts) when available. Can make HTTP requests, e.g. to import or export data without passing it through model context. This tool makes changes with the user's full API access: show the user the code and what it will do before calling, and keep it short, readable, and single-purpose. Prefer run_analysis_script for anything that doesn't change data.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "run_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript code to execute (Cloud Script API, full access) | |
| summary | No | One-sentence plain-language summary of what this script is intended to do, shown to the user in the confirmation prompt alongside the code (always provide this) | |
| project_id | No | ID of the project to run the script in (call API_queryProjects to look up a project ID if you don't already have one). Optional: omit it to run in organization-only context — the `project` global is then undefined, while the `organization` global is still available (e.g. for billing or usage questions). |