Skip to main content
Glama

spawn_exec

Run read-only JavaScript against a live Spawn room to query objects or read their state. Requires a live room; use spawn_client_join or spawn_play_open first to avoid 409 errors.

Instructions

Run a read-only JavaScript snippet against the live room (e.g. query objects, read an object's state). Pushing is the only write path. Needs a LIVE ROOM, and a room boots for a PLAYER, never for a door: the cheapest way to get one is spawn_client_join, which stands your own body in the world with no browser and no GPU (spawn_play_open boots one too, and is the right call when you need to SEE rather than query). Without either you get 409 no_live_room or a 5xx. api.sql is NOT available here at all (the endpoint is read-only server-side and refuses SQL outright, even SELECT) — there is no way to read the game database through this server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesJS to eval in the live room, e.g. return api.query({}).slice(0,50).map(o => ({id:o.id, pos:o.feetPosition, tags:o.tags}))
projectDirNoAbsolute path to the Spawn game project (game.json / .env). Defaults to SPAWN_PROJECT_DIR or the MCP process cwd.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: it declares the operation read-only, notes pushing is the only write path, discloses error codes for missing preconditions, and explicitly rules out api.sql (even SELECT). This is rich disclosure of constraints and failure behavior beyond structured fields.

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?

Front-loaded with the core action and constraint, and each sentence adds a real constraint (write-path rule, room prerequisite, error codes, SQL exclusion). The parenthetical aside about spawn_play_open is slightly dense but earns its place by routing the agent.

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?

For a 2-param read-only tool with no output schema, the description covers prerequisites, alternatives, failure modes, and a key limitation (no SQL). It does not describe the return value or pagination behavior, a minor gap given the schema's example mapping mitigates it somewhat.

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 100%, so both parameters (script, projectDir) are already documented in the schema, including an example return shape. The description adds context about what the script can do but no syntax or format details beyond the schema. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Run a read-only JavaScript snippet against the live room,' with clarifying examples (query objects, read an object's state). It differentiates itself from spawn_play_open ('the right call when you need to SEE rather than query') and spawn_client_join. It does not, however, explicitly contrast with the close sibling spawn_play_eval, which an agent might confuse it with.

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 states the prerequisite (a LIVE ROOM), the cheapest alternative to establish one (spawn_client_join), and the alternative for visual needs (spawn_play_open). It also names the failure modes (409 no_live_room or 5xx) when neither is used. This is clear when-to-use and when-not guidance with named alternatives.

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