Skip to main content
Glama

notion_run_code

Execute custom async Playwright code on a Notion Desktop page for advanced automation or unsupported actions; prefer dedicated tools and avoid deletions.

Instructions

Escape hatch: run async (page) => {...} against the target page (Playwright Page with page.n helpers: n.db., n.table., n.tabs.*, n.slash, n.guard… see SKILL.md). Prefer the dedicated tools; never delete with this; use notion_delete_blocks so a backup exists.

Input Schema

NameRequiredDescriptionDefault
codeYes
pageNoPage URL or id. Default: the active Notion tab.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

No annotations, so the description carries the burden and does well: it discloses that arbitrary code runs with a helper API surface and warns about destructive use. It stops short of stating sandboxing, permissions, error behavior, or what the run returns, which matters for an open-ended code-execution tool.

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

Conciseness5/5

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

Two dense sentences, front-loaded with the 'Escape hatch' framing and the safety constraint. Every clause (helpers, prefer-dedicated, never-delete, use-delete-blocks) earns its place.

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?

Given no output schema and no annotations, the description covers invocation shape and safety well. The one gap is that it never explains how the result of the executed code is surfaced to the agent, which for a code-exec tool leaves return handling ambiguous.

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 50% (only `page` is documented), but the description compensates by specifying the `code` parameter's exact shape as an `async (page) => {...}` function and enumerating available helpers. The `page` default is already in the schema, so the description adds rather than repeats.

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: run an `async (page) => {...}` function against the target page. The 'Escape hatch' framing plus the `page.n` helper namespace makes it instantly distinguishable from the dedicated siblings like notion_insert or notion_read.

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?

Explicitly says to prefer dedicated tools, gives a hard exclusion ('never delete with this'), and routes deletion to notion_delete_blocks with the reason (so a backup exists). This is textbook when/when-not/alternative guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.