Skip to main content
Glama

run_code

Destructive

Execute arbitrary JavaScript in the Hatchable isolate runtime to test database queries, auth, storage, or API calls without deploying. Returns result instantly.

Instructions

Execute arbitrary JS in the project's isolate runtime with the same bindings a deployed function gets: db, auth, email, storage from "hatchable", plus process.env and global fetch. The return value of the snippet becomes the result field.

Use this as a REPL: probe the database, verify a computation, test an API shape before committing it to a file. Nothing is persisted — the snippet runs once and disappears.

Caps: 5s default timeout (max 30s), 256 KB max source length.

Example: run_code({ project_id, code: const { db } = await import("hatchable"); const { rows } = await db.query("SELECT count(*) FROM users"); return rows[0]; })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID
codeYesJS snippet. Use `return` to produce a result.
timeout_msNoExecution timeout in ms (default 5000, max 30000)
Behavior5/5

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

Beyond annotations (destructiveHint true), description adds: snippet runs once and disappears, environment bindings, timeout caps (5s default, 30s max), 256KB source limit, return value becomes result field. No contradiction with annotations.

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?

Three concise sentences plus a code example. Every sentence adds value: first sentence defines tool, second guides usage, third lists constraints. Example demonstrates return pattern. No filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Complete for a REPL tool: purpose, bindings, safeguards, example. No output schema needed since return value is described as result field. All critical info present.

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 100% so baseline is 3. Description adds value by explaining that code must use `return` to produce result, and that timeout_ms has a max of 30000. However, no additional meaning beyond what schema provides for project_id or code besides the return convention.

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?

Clearly states it executes arbitrary JS in an isolate runtime with specific bindings (db, auth, etc.), distinguishes from siblings like run_function (which runs deployed functions) and execute_sql (which runs SQL only).

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 tells when to use as a REPL: probe database, verify computation, test API shape. Notes nothing is persisted. Implicitly contrasts with run_function (deployed) and write_file (persisted).

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Woobox/hatchable-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server