Run Luau on the active client
run-luauExecute self-contained Luau in the active Roblox client and get the first returned value back. Use when your script needs no other MCP tools.
Instructions
Execute arbitrary Luau in the active Roblox client and return its first returned value (decoded from JSON). This is the core PURE-LUAU execution tool — no access to this server's other tools from inside the script. If you want to use any other tool's data (get-players, search-instances, discover-player-values, anything from list-tools) inside your Luau, STOP and use the script tool instead: it binds a live mcp table so you can write local p = mcp.getPlayers() / mcp.searchInstances({...}) / mcp.parallel({...}) and use the results directly — one call instead of dozens of round-trips. Use run-luau only when your Luau is fully self-contained (reading workspace, looping over a part, returning a value). return the value(s) you want back; do NOT call JSONEncode yourself, the connector serializes automatically. A chunk that returns nothing yields null. Use eval-expression for a single expression, or the higher-level inspection tools for structured reads. Signature: { source: string, threadContext: number?, timeoutMs: number?, client: string?, agent: string? }. Phase: act; cost=medium; idempotency=contextual-write. Requires: active-client, explicit-mutation-approval, validated-source. Produces: operation-receipt. Verify with: assert-state. Safety: MUTATING; executes caller-selected behavior in the live client. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent | No | Optional. A stable label for WHICH agent is calling when several share this MCP session (e.g. 'researcher'). Gives that agent its own fair scheduling lane, its own persistent VM on each game, and its own queue budget, so co-tenant agents don't starve or clobber each other. | |
| client | No | Optional. Run on a specific connected client — its clientId OR username — for THIS call only, overriding your session's select-client binding without changing it. Lets multiple agents drive different games at the same time; omit to use your session's selected client. | |
| source | Yes | Luau source to execute. Use `return <value>` to get data back. | |
| timeoutMs | No | Per-call deadline in milliseconds. Server default if omitted. | |
| threadContext | No | Roblox thread identity to run under (e.g. 2 = game scripts, 8 = elevated). Server default if omitted. |