Skip to main content
Glama
ingjohnfigueroablanco

Browser-MCP Navigator

js_eval

Run custom JavaScript in the browser to automate interactions, extract data, or perform bulk operations with a single tool call.

Instructions

Ejecuta JavaScript arbitrario en la pagina. Devuelve resultado + snapshot.

ref=None → evalua script como expresion en window context. ref=@eN → ejecuta script como funcion con el elemento como this.

Ejemplos basicos: scroll abajo: js_eval("window.scrollBy(0, 500)") drag elemento: js_eval("el.dispatchEvent(new DragEvent('dragstart',...))", ref="@e5") leer atributo: js_eval("return this.getAttribute('data-id')", ref="@e12") click forzado: js_eval("this.click()", ref="@e7") esperar async: js_eval("return await fetch('/api').then(r=>r.json())")

RENDIMIENTO — operaciones en lote: Cada tool call = un round-trip LLM. Para crear/editar/extraer N elementos, escribe UN loop async en JS en lugar de llamar N veces a click/fill/js_eval.

Ejemplo — rellenar y enviar un formulario 20 veces en UNA llamada: js_eval(""" (async () => { const users = [ {name:'Ana',user:'ana01',role:'Operador'}, {name:'Luis',user:'luis02',role:'Supervisor'}, ]; const set = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,'value').set; const fire = (el,v) => { set.call(el,v); el.dispatchEvent(new Event('input',{bubbles:true})); }; const results = []; for (const u of users) { document.querySelector('button.agregar, [aria-label*=gregar]').click(); await new Promise(r => setTimeout(r, 400)); const inp = document.querySelectorAll('input:not([type=checkbox])'); fire(inp[0], u.name); fire(inp[1], u.user); document.querySelector('button[type=submit], button.crear').click(); await new Promise(r => setTimeout(r, 300)); results.push(u.user); } return results; })() """)

Para datasets grandes usa js_eval_loop() que inyecta items automaticamente.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNo
scriptYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations provided, so description carries full burden. It covers async execution, element context, and batch behavior. However, it does not disclose potential risks (e.g., page state changes, security implications, error handling). Adequate but not exhaustive.

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?

Description is fairly long but well-structured with examples, performance advice, and clear sections. Front-loaded with core purpose. Slightly verbose but every section adds value.

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 output schema exists (though not shown), return values need not be explained. Covers main use cases, batch processing, and sibling differentiation. Mentions js_eval_loop for large datasets. Complete for the tool's complexity.

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 0%, so description must compensate. It explains 'script' as JavaScript code and 'ref' with two modes (None vs @eN) with examples. Adds meaningful context beyond schema.

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 JavaScript on the page returning result + snapshot. Distinguishes between ref=None (window context) and ref=@eN (element context). Examples clarify usage. Sibling js_eval_loop is mentioned for batch operations, differentiating use cases.

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 explains when to use ref=None vs ref=@eN. Provides a performance section advising batch operations to avoid multiple round-trips, and directs to js_eval_loop for large datasets. This gives clear when-to-use and when-not-to-use guidance.

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/ingjohnfigueroablanco/Fast-browser-MCP'

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