Skip to main content
Glama

pbi_run_code

Executes an async JavaScript function with the Playwright page object to send trusted mouse and keyboard inputs, enabling automation of report interactions not possible with standard tools.

Instructions

TRUSTED escape hatch (browser_run_code_unsafe equivalent). Runs an async JS function with the live Playwright reportView page — page.mouse/page.keyboard give REAL trusted input (unlike pbi_eval, which is page.evaluate and cannot do trusted clicks/keys). Use for rediscovery + interactions the canned tools do not cover. The code string must be an async arrow/function taking (page); its return value is JSON-serialized. Rejects powerBIAccessToken. UNSAFE: arbitrary automation — mutating clicks change report state, so restore after. The powerBIAccessToken rejection is a best-effort textual guard (a regex on the code string), not a sandbox. NOTE inside page.evaluate sandboxes setTimeout is undefined — use page.waitForTimeout(ms).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesasync (page) => { ... } — returns JSON-serializable
Behavior5/5

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

Despite no annotations, the description extensively discloses behavioral traits: trusted input via page.mouse/keyboard, arbitrary automation risk, best-effort powerBIAccessToken guard, need to restore state after mutations, and setTimeout inside page.evaluate. This exceeds basic 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 dense with useful information and front-loaded with the 'escape hatch' purpose. While every sentence earns its place, the length is slightly high; a more streamlined presentation could improve readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 param, no output schema), the description is fully comprehensive: it covers purpose, usage context, behavioral warnings, parameter requirements, and security limitations. No unnecessary omissions.

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 100% for the single parameter 'code', but the description adds meaningful context: it must be an async arrow/function taking (page), return value is JSON-serialized, and includes a security guard note. This adds value beyond the schema description.

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 an async JS function with a live Playwright page, providing real trusted input. It explicitly distinguishes itself from pbi_eval by contrasting with page.evaluate, making the purpose and differentiation precise.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description advises use for rediscovery and interactions not covered by canned tools, and warns about unsafe automation and state restoration. While it implicitly favors canned tools when available, it lacks explicit 'when not to use' or direct alternatives beyond pbi_eval.

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/bibiibjorn/pbi-webview2'

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