Skip to main content
Glama
ingjohnfigueroablanco

Browser-MCP Navigator

js_eval_loop

Execute a script on each item in a list in a single call, replacing multiple round-trips. Returns results per item plus final snapshot.

Instructions

Ejecuta script una vez por cada item — UNA llamada en lugar de N.

La variable item esta disponible en script como objeto JS plano. Devuelve array JSON con {ok, result, error} por item + snapshot final.

USAR ESTO en lugar de llamar js_eval/click/fill N veces para operaciones bulk. Cada tool call = un round-trip LLM. Un loop aqui = 50-100x mas rapido para N>5.

Parametros: items — lista de objetos, uno por iteracion script — JS a ejecutar por item; puede usar await; item esta en scope delay_ms — espera entre iteraciones (default 300ms; bajar si la app es rapida)

Ejemplo — crear 20 usuarios en una sola llamada: js_eval_loop( items=[ {"name": "Ana Garcia", "user": "agarcia", "phone": "3101234567", "email": "ana@corp.com", "area": "TI", "role": "Operador"}, ... ], script=""" document.querySelector('button[aria-label*="gregar"], button.agregar').click(); await new Promise(r => setTimeout(r, 400)); const inp = document.querySelectorAll('input:not([type=checkbox]):not([type=radio])'); const s = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,'value').set; const fire = (el,v) => { s.call(el,v); el.dispatchEvent(new Event('input',{bubbles:true})); el.dispatchEvent(new Event('change',{bubbles:true})); }; fire(inp[0], item.name); fire(inp[1], item.user); fire(inp[2], item.phone); fire(inp[3], item.email); fire(inp[4], item.area); const sel = document.querySelectorAll('select')[0]; const ss = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,'value').set; ss.call(sel, item.role); sel.dispatchEvent(new Event('change',{bubbles:true})); document.querySelector('button[type=submit], button.crear').click(); return item.user; """ )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYes
scriptYes
delay_msNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries full burden and does well: it explains the execution flow (script per item, item variable available), return format (array with ok/result/error per item plus final snapshot), and the delay parameter. However, it does not explicitly mention potential risks of running arbitrary JS or whether the tool is destructive, which could be important for safety.

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?

The description is well-structured: a brief summary, then explanation of variable and return, usage guidance, parameter details, and a comprehensive example. Every sentence adds value without unnecessary fluff, balancing detail with conciseness.

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 the complexity, the description covers the main aspects: what it does, how to use it, and what it returns. It even provides a working example. However, it does not address edge cases like empty items or script errors, and the output schema is not shown but the description mentions the return format. Slightly more detail on error handling would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It thoroughly explains each parameter: items (list of objects), script (JS with await and item in scope), delay_ms (default 300ms). The detailed example further clarifies usage, providing much-needed semantics beyond the bare schema types.

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 the tool's purpose: 'Ejecuta script una vez por cada item — UNA llamada en lugar de N.' It distinguishes from sibling tools like js_eval by emphasizing that it handles bulk operations in a single call, making the purpose and uniqueness evident.

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?

The description explicitly advises to use this tool instead of calling js_eval/click/fill N times for bulk operations, providing a clear usage context. It also explains the performance benefit: 'Cada tool call = un round-trip LLM. Un loop aqui = 50-100x mas rapido para N>5.' This gives strong guidance on when to use it.

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