Skip to main content
Glama

ai_ui_eval

Evaluate JavaScript in the live MIT App Inventor page to run custom editor interactions; available only when the server starts with AI2_ALLOW_EVAL=1.

Instructions

Escape hatch: evaluate JavaScript in the App Inventor page. Disabled unless the server was started with AI2_ALLOW_EVAL=1, because it runs arbitrary code in a signed-in session.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "script": "<script>"
    },
    "name": "ai_ui_eval"
  }
}

Input Schema

NameRequiredDescriptionDefault
scriptYesJavaScript expression

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.1

TDQS

A4.2/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full behavioral burden, and it does disclose the critical trait: it 'runs arbitrary code in a signed-in session' and is off by default behind an environment flag. That is exactly the risk context an agent needs before invoking. It does not say whether side effects persist, whether the result is returned, or what happens on error, so it falls short of a 5.

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?

Two clauses with zero waste: the identifying label 'Escape hatch' is front-loaded, the action follows, and the disable condition plus its reason are packed into a single subordinate clause. Nothing is repeated from the schema and nothing could be cut without losing a fact.

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?

For a one-parameter, no-output-schema tool, the description covers purpose, gating condition, and the security rationale, which is enough to decide whether to call it. The only meaningful gap is that it never says what the evaluation yields or how results/errors are surfaced, which matters for an eval tool.

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?

Schema coverage is 100% and there is only one required parameter, so the schema already documents 'script' as a JavaScript expression; the description adds the execution context (App Inventor page, signed-in session) but no syntax, expected return value, or length/complexity constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

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?

States a specific verb and resource: 'evaluate JavaScript in the App Inventor page', and the leading phrase 'Escape hatch' tells the agent this is the generic fallback rather than one of the structured ai_* siblings (ai_test, ai_validate, etc.). An agent can tell what it does and roughly where it sits relative to the catalog without opening the schema.

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?

Gives a concrete precondition for use: it is 'Disabled unless the server was started with AI2_ALLOW_EVAL=1', which tells the agent when the call will fail. The 'escape hatch' framing implies it is a last resort after the purpose-built ai_* tools, but no alternative is named explicitly and there is no explicit 'prefer X instead' routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.