Skip to main content
Glama
mya11yreport

mya11yreport-mcp

by mya11yreport

Evaluate JavaScript

evaluate

Run a JavaScript expression or function in the live page to inspect DOM details like computed styles, geometry, or element state when a snapshot is insufficient. Returns serializable results for deeper accessibility analysis.

Instructions

Evaluates a JavaScript expression or function in the session page via Playwright page.evaluate and returns its value. Use it to inspect the live DOM (computed styles, geometry, custom element state) when get_page_snapshot is not enough. The result must be serializable across the Playwright boundary; non-serializable or undefined values come back as null with serializable:false. This runs arbitrary page JavaScript — only evaluate code you intend to run.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argNoOptional JSON-serializable value passed as the first argument when `expression` is a function. Ignored for plain expressions.
sessionIdYesSession id returned by start_session. Required on every stateful tool call.
expressionYesJavaScript evaluated in the page context. Either a plain expression (e.g. "document.title") or a function/arrow-function body (e.g. "() => document.querySelectorAll(\"a\").length", or "(n) => n + 1"). Functions are invoked with `arg`; plain expressions ignore it. Multi-statement logic needs a function body.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.3

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden. It discloses that results must be serializable, that non-serializable or undefined values return as null with a serializable:false flag, and that the tool runs arbitrary page JavaScript. These are essential behavioral traits not otherwise communicated, making the description highly transparent.

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 three sentences with zero wasted words. The primary purpose is first, followed by a concrete use case and a critical warning. Every sentence adds distinct value, and the structure front-loads the most important information.

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?

For a tool that executes arbitrary JavaScript, the description covers the key expectations: return format (serializability and null behavior), the use case, and the safety warning. Since there is no output schema, the description fully explains what the agent will receive. Combined with the complete parameter schema, nothing an agent needs to call this correctly is missing.

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 description coverage is 100%, so the schema already documents all three parameters in detail, including the role of `arg` and functions vs. plain expressions. The description adds only the serializability requirement context, which is useful but not necessary for parameter understanding. Baseline 3 is appropriate since 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?

The description clearly states the verb (evaluates), the resource (JavaScript expression or function in the session page), and the mechanism (Playwright page.evaluate). It also distinguishes from the sibling get_page_snapshot by explicitly noting when to use one over the other, so an agent can tell them apart without opening schemas.

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 provides explicit guidance: 'Use it to inspect the live DOM (computed styles, geometry, custom element state) when get_page_snapshot is not enough.' This names the alternative and the condition that selects it. It also warns about arbitrary JavaScript execution, which is a critical usage consideration.

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