execute
Run sandboxed Python to invoke Google Workspace tools, chaining calls in one block to automate multi-step workflows.
Instructions
Run sandboxed Python that calls this server's Google Workspace tools via await call_tool(tool_name, params), chaining calls in one block.
Use when: you know which tools to call. To find tool names first use search or tags; for exact parameters use get_schema; to look up past results instead, use semantic_search.
Behavior: each call_tool runs the real tool immediately — sends, edits, and deletes take effect; there is no dry-run.
Use return to produce output; prefer returning the final answer from a single block.
Only call_tool(tool_name: str, params: dict) -> Any is available in scope. Unknown tool names raise NotFoundError; disallowed syntax raises SandboxError.
SANDBOX RESTRICTIONS — these produce SandboxError, avoid them:
sorted_(items, key=lambda x: x['k'])→ lambda args fail; use builtins likekey=lenor sort manuallyimportonly covers a small stdlib subset (e.g. json); no third-party modules — prefer the built-in helpers listed below
Built-in helpers (import is not available — use these instead):
now(tz_offset=0)→ current datetime string (UTC by default)today(tz_offset=0)→ current date 'YYYY-MM-DD' (UTC by default)days_ago(n, tz_offset=0)→ ISO datetime string N days agohours_ago(n, tz_offset=0)→ ISO datetime string N hours agoformat_date(iso_str, fmt='%Y-%m-%d %H:%M')→ formatted dateparse_date(iso_str)→ normalized ISO datetimetimestamp()→ current unix timestamp (int)to_json(obj, indent=None)→ JSON stringfrom_json(s)→ parsed objecturl_encode(s)→ URL-encoded stringurl_decode(s)→ URL-decoded stringurl_join(base, *parts)→ joined URL pathquery_string(params)→ URL query string from dictre_find(pattern, text)→ list of matchesre_match(pattern, text)→ boolre_sub(pattern, repl, text)→ substituted stringtruncate(text, n=80)→ truncated with '...'dedent(text)→ remove common leading whitespacewrap_text(text, width=72)→ word-wrap to widthpad_left(s, width, char=' ')→ right-justify / zero-padpad_right(s, width, char=' ')→ left-justifyjoin(items, sep=', ')→ joined stringhtml_escape(s)→ HTML-safe stringsqrt(n),ceil(n),floor(n)→ mathround_(n, digits=2),abs_(),min_(),max_(),sum_()→ mathsorted_(items, key=None, reverse=False)→ sorted listunique(items)→ deduplicated list (preserves order)flatten(lists)→ flat list from nested listscounter(items)→ dict of {item: count}chunk(items, size)→ list of chunkszip_(*iterables)→ zipped as list of listsdict_get(d, 'a.b.c', default=None)→ nested dict accessmd5(s),sha256(s)→ hash hex digestsgather_tools(calls)→ run multiple tool calls sequentially;callsis a list of[tool_name, params]pairs, returns list of results (assign to variable, then index:r = await gather_tools([...]); a, b = r[0], r[1])sleep(seconds)→ async sleep
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python async code to execute tool calls via call_tool(name, arguments) |