Skip to main content
Glama

Explain why an element renders the way it does

visual_inspect

Explains why a selected element renders incorrectly by returning computed styles, box metrics, ancestor colour chain, and matching CSS rules with source origins for debugging.

Instructions

The companion to visual_audit: audit answers WHAT looked wrong, this answers WHY. Returns the computed styles, the box metrics, the ancestor colour chain, and every CSS rule that matches the selector with its origin (file:line in the project). It does not resolve which rule wins — specificity, order and !important are left for you to judge from the evidence.

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": {
      "url": "<url>",
      "selector": "<selector>"
    },
    "name": "visual_inspect"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesAbsolute URL, path relative to baseUrl, or local HTML file path.
engineNoEngine to inspect in. Chromium returns file:line for every rule via CDP; webkit/firefox return selectors and declarations from the CSSOM, without line numbers.
selectorYesCSS selector. Reuse the selector reported by a finding.
viewportNoViewport to render at. Default 1440x900; match the finding's viewport for a responsive bug.
propertiesNoComputed properties to include. Defaults to a curated layout/colour set.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.3

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the shape of the evidence returned and, critically, that it does NOT resolve the cascade winner — specificity, order and !important are left to the caller, which prevents a common misreading of results. It also flags the engine-dependent file:line availability. Remaining gaps are error/empty-match behavior and output size, but the core behavioral contract is clear.

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?

Three tight sentences, front-loaded with the sibling contrast and the payload, then the one behavioral caveat that matters. No filler or restatement of the title.

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?

There is no output schema, so the description must describe return values, and it does so concretely (styles, box metrics, ancestor colour chain, matched rules with origin). A brief note on what happens when the selector matches nothing, or on result volume for large rule sets, is the only notable omission.

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 explains url, engine, selector, viewport and properties, including the chromium file:line distinction. The description adds no new meaning about parameter values or formats beyond what the schema provides, which is the expected baseline.

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 concrete verb and enumerates the exact return payload (computed styles, box metrics, ancestor colour chain, matching CSS rules with file:line origin). It also explicitly positions itself against the sibling visual_audit with a WHAT vs WHY contrast, so an agent can pick between them without opening either schema.

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?

Names the alternative tool and the condition that selects it: audit answers what looked wrong, this answers why. The schema-level hint to reuse a finding's selector reinforces the intended workflow, leaving little to infer about when to reach for this tool.

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