Skip to main content
Glama

Run Code in VM

run_code_in_vm
Destructive

Run a Node.js snippet on the project's compute VM and return its stdout and stderr. ESM by default (a bare require() snippet runs as CJS). The project's npm dependencies are importable and the network works, so a snippet can call the project's /_api/* endpoints (get_preview_url → apiBaseUrl). It runs in an isolated directory: the project's env vars, secrets and source files are not available.

A _floot global gives helpers that run in the project's server context, limited to this project:

  • runSQLQuery({ query, resourceName?, reasonAndExplanationForNotReadOnly? }): read-only by default; with a reason, additive writes (INSERT, CREATE TABLE). Other statements are refused: use execute_sql for those, and query_database for one-off reads.

  • Usage and logs: getHostingUsage, getLambdaUsage, getPushHistory, getProdBackendLogs (guides: hosting-cost-analysis, push-notification-history, prod-backend-logs).

  • Storage: storageList, storageGetUrl, storageGetFileSizes, storageUpload, storageDelete, getFileById (guide: static-storage).

Input Schema

NameRequiredDescriptionDefault
codeYes
projectIdYes
timeout_secondsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=false, destructiveHint=true and openWorldHint=true, so the safety profile is partly covered. The description adds substantial context beyond that: ESM default with CJS fallback, an isolated directory where project env vars, secrets and source files are unavailable, working network access, and the read-only-by-default/write-refusal policy of runSQLQuery.

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

Conciseness4/5

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

The core behavior is front-loaded in the first sentence, followed by an isolated-directory caveat and a clearly bulleted list of _floot helpers. It is long but nearly every line carries distinct information; the helper list is dense yet earns its space given the 0% schema coverage.

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?

With no output schema, the description correctly states the return values (stdout and stderr). It is strong on runtime semantics and helper routing, but leaves timeout_seconds and projectId unexplained, a minor gap for a 3-parameter code-execution tool.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must carry parameter meaning. It explains `code` well (Node.js, ESM by default, bare require() runs as CJS) but says nothing about `projectId` or `timeout_seconds`, leaving two of three parameters undocumented in both schema and description.

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?

The first sentence names a specific verb (run), resource (Node.js snippet), execution target (the project's compute VM), and return value (stdout and stderr). It also implicitly separates itself from the sibling run_code_in_browser by specifying the VM, so an agent can route without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit routing for the SQL helpers: read-only by default, writes need a reason, and 'use execute_sql for those, and query_database for one-off reads.' It also points to get_preview_url/apiBaseUrl for hitting project endpoints. It stops short of saying when NOT to use this tool versus run_code_in_browser or run_tests, so it is clear context rather than full when/when-not coverage.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources