Skip to main content
Glama

Run Code in Browser

run_code_in_browser
Destructive

Run a TypeScript snippet inside the RUNNING APP's preview document in the user's open Floot editor (document/window ARE the live app's DOM — query document directly; do NOT look for a preview iframe, there is none from the snippet's point of view). This is the CANONICAL way to read the live app's DOM — measuring elements, reading computed styles, inspecting rendered output. If you ALSO have your own browser/DevTools automation, it CANNOT reach into the Floot preview (it renders in a cross-origin iframe — your clicks silently no-op and its DOM is invisible to you), so use THIS tool for anything inside the app, not those. _floot.* helpers are available. The snippet MUST export default async function and return a string — the returned value is the tool result (unlike run_code_in_vm, which is a plain script returning stdout). It can import project files by relative path from the root (e.g. ./helpers/foo). Requires the user to have the project open in the editor — fails fast with guidance if no browser is connected; prefer run_code_in_vm for anything that doesn't need the DOM. Simple interaction checks work well: element.click() a button, await a beat, then read the resulting DOM/state to verify a flow end-to-end — do this instead of asking the user to test basic interactions. Multi-step e2e journeys and typed text input are where simulation gets unreliable (React controlled inputs ignore assigned values) — leave THOSE to the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesA TypeScript module that exports a default async function returning a string; that string is the tool result. Runs at the project root, so import other files by relative path. No top-level `return` (it's a module, not a function body) and no React hooks (not a component). Example: export default async function () { const el = document.querySelector("main"); return JSON.stringify({ width: el?.clientWidth ?? null }); }
projectIdYes

TDQS

A4.3/5.0
Behavior4/5

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

The description adds useful context beyond the destructiveHint=true and readOnlyHint=false annotations: it details the execution environment (live DOM, no iframe), the return-value contract (string from the async function), and the fail-fast behavior when no browser is connected. It also notes that simple clicks work while typed input is unreliable, setting accurate expectations.

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 description is lengthy but each sentence adds value: it front-loads the critical execution model, then logically covers alternatives, code requirements, and limitations. No redundancy; the structure helps an agent quickly grasp the tool's scope and constraints.

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, the description explains the return value clearly (the string returned from the function). It covers prerequisites, failure behavior, and appropriate use cases, making it sufficient for an agent to invoke correctly. Minor gaps like error handling or `_floot.*` helper details are not critical for basic usage.

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?

The schema already covers the 'code' parameter in detail (format, example, restrictions), and the description reinforces it. However, 'projectId' is only implicitly tied to the requirement that the project be open in the editor; there is no explicit definition of what value to pass. With 50% schema coverage, the description partially compensates but leaves projectId under-explained.

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 description clearly states it runs a TypeScript snippet in the running app's live DOM, naming the verb and resource precisely. It differentiates from run_code_in_vm by the return-value behavior and positions itself as the canonical way to read the app's DOM, distinguishing it from siblings like fetch or execute_sql.

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?

It provides explicit when-to-use guidance: 'prefer run_code_in_vm for anything that doesn't need the DOM' and 'use THIS tool for anything inside the app' vs external automation. It also advises against multi-step e2e and typed input, directing the agent to leave those to the user, giving clear exclusions.

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.

TDQS

A3.6/5.0
Disambiguation4/5

Tools are mostly distinct, but there is some overlap among file-modifying tools (edit_file, write_file, apply_patch) and between run_code_in_vm and run_code_in_browser. Detailed descriptions and clearly scoped use cases help agents select correctly.

Naming Consistency4/5

Most tools follow a verb_noun snake_case pattern (create_project, list_files, execute_sql), but a few deviate (apply_patch, card_upload_asset, run_code_in_vm). Overall readable and predictable, with only minor inconsistencies.

Tool Count2/5

With 46 tools, the server exceeds the typical well-scoped range and approaches the extreme threshold. While the broad scope of a full development platform justifies many tools, this count may overwhelm agents and increase misselection risk.

Completeness4/5

The tool surface covers the full development lifecycle: project creation, file operations, database management, resource provisioning, deployment, testing, and debugging. Minor gaps exist (e.g., no delete_project or checkpoint management), but core workflows are well-supported.

Resources