Skip to main content
Glama

app_execute_js

Execute JavaScript in the running Tauri app to access DOM, call functions, read/write localStorage, or invoke backend commands. Bypass WebDriver limitations like OS dialogs by calling backend commands directly.

Instructions

Run arbitrary JavaScript in the running app window and return the result. Not limited to clickable elements — read any DOM/JS state, call window functions, dispatch synthetic events, read/write localStorage, or invoke a Tauri backend command directly via await window.__TAURI_INTERNALS__.invoke("cmd_name", { arg }) (always present in Tauri v2). This can do anything the app's own frontend can do, including real side effects (writing config, filesystem, launching processes) — there is no sandboxing. script is a function body; return a value for a result, await directly for async work. Also the documented workaround for OS-native dialogs (file/folder pickers) that WebDriver can't drive: call the backend command directly instead of clicking through the dialog.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesJavaScript source, executed as a function body
Behavior5/5

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

With no annotations, the description fully discloses behavioral traits: it can cause real side effects (writing config, filesystem, launching processes), has no sandboxing, and supports async execution via `await`. This is excellent transparency.

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 moderately long but every sentence adds value, covering purpose, capabilities, side effects, and usage patterns. It is front-loaded with the main purpose and avoids redundancy, though it could be slightly more concise.

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 complexity (arbitrary JS execution) and lack of output schema, the description is thorough: it explains what the tool can do, its limitations (no sandboxing), async behavior, and specific use cases (e.g., dialogs). No critical information is missing.

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?

The schema already describes `script` as 'JavaScript source, executed as a function body'. The description adds meaning by explaining that `return` yields a result and `await` works directly for async code, which enriches 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 the verb 'Run arbitrary JavaScript' and the resource 'in the running app window'. It distinguishes from sibling tools by emphasizing it is not limited to clickable elements and can read any DOM/JS state, call functions, etc., making its purpose unique.

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 provides context on when to use this tool, such as reading state, calling backend commands, and as a workaround for OS-native dialogs. However, it does not explicitly compare it to sibling tools for typical actions like clicks or typing, nor does it specify when not 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/FrengkyS1/tauri-mcp'

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