Skip to main content
Glama

interceptor_browser_snapshot

Capture an ARIA accessibility snapshot of a web page as a YAML role tree, enabling LLM-driven page understanding without HTML parsing.

Instructions

Take an ARIA accessibility snapshot of the bound page (YAML-formatted role tree). Great for LLM-driven page understanding without parsing HTML.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_idYesTarget ID from interceptor_browser_launch or interceptor_camoufox_launch
selectorNoRoot selector to snapshot (default: 'body')body
modeNoSnapshot mode — 'ai' adds ref attributes for locator reusedefault

Implementation Reference

  • src/index.ts:69-69 (registration)
    Registration call: registerDevToolsTools(server) is invoked to register all devtools tools including interceptor_browser_snapshot.
    registerDevToolsTools(server);
  • Input schema for interceptor_browser_snapshot: target_id (string), selector (optional string, default 'body'), mode (optional enum 'default'|'ai', default 'default').
    {
      target_id: z.string().describe("Target ID from interceptor_browser_launch or interceptor_camoufox_launch"),
      selector: z.string().optional().default("body").describe("Root selector to snapshot (default: 'body')"),
      mode: z.enum(["default", "ai"]).optional().default("default").describe("Snapshot mode — 'ai' adds ref attributes for locator reuse"),
    },
  • Handler implementation: resolves the Playwright Page via getPageForTarget, calls page.locator(selector).ariaSnapshot({mode}), and returns the snapshot text along with target_id, url, title, and root selector.
    async ({ target_id, selector, mode }) => {
      try {
        const page = await getPageForTarget(target_id);
        const snapshot = await page.locator(selector).ariaSnapshot({ mode });
        return {
          content: [{
            type: "text",
            text: truncateResult({
              status: "success",
              target_id,
              url: page.url(),
              title: await page.title().catch(() => ""),
              root: selector,
              snapshot,
            }),
          }],
        };
      } catch (e) {
        return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] };
      }
    },
  • Registration function registerDevToolsTools which calls server.tool('interceptor_browser_snapshot', ...) to register the tool on the MCP server.
    export function registerDevToolsTools(server: McpServer): void {
      // ── snapshot ──────────────────────────────────────────────────
    
      server.tool(
        "interceptor_browser_snapshot",
        "Take an ARIA accessibility snapshot of the bound page (YAML-formatted role tree). " +
        "Great for LLM-driven page understanding without parsing HTML.",
        {
          target_id: z.string().describe("Target ID from interceptor_browser_launch or interceptor_camoufox_launch"),
          selector: z.string().optional().default("body").describe("Root selector to snapshot (default: 'body')"),
          mode: z.enum(["default", "ai"]).optional().default("default").describe("Snapshot mode — 'ai' adds ref attributes for locator reuse"),
        },
        async ({ target_id, selector, mode }) => {
          try {
            const page = await getPageForTarget(target_id);
            const snapshot = await page.locator(selector).ariaSnapshot({ mode });
            return {
              content: [{
                type: "text",
                text: truncateResult({
                  status: "success",
                  target_id,
                  url: page.url(),
                  title: await page.title().catch(() => ""),
                  root: selector,
                  snapshot,
                }),
              }],
            };
          } catch (e) {
            return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] };
          }
        },
      );
  • getPageForTarget helper: resolves a target_id to a Playwright Page, handling both cloakbrowser (browser_*) and camoufox (camoufox_*) target types.
    export async function getPageForTarget(targetId: string): Promise<Page> {
      const entry = getEntry(targetId);
      if (isCamoufoxTargetId(targetId)) {
        return ensureCamoufoxPage(entry as CamoufoxEntryWithDriver);
      }
      const browserEntry = entry as BrowserTargetEntry;
      if (browserEntry.page.isClosed()) {
        throw new Error(`Page for browser target '${targetId}' is closed.`);
      }
      return browserEntry.page;
    }
Behavior2/5

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

No annotations provided; description lacks disclosure of side effects, read-only nature, or permission requirements. Only states it's a snapshot, implying no modification but not explicit.

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 succinct sentences, no filler. Front-loaded with action and output format.

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

Completeness3/5

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

Covers basic purpose and output but lacks detail on return value structure, mode differences, and no behavioral notes. Adequate but leaves gaps for an agent to infer.

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?

All parameters are documented in the schema (100% coverage), so description adds little value. It only hints at output format (YAML) but not parameter specifics beyond what schema already provides.

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?

Clear verb+resource: 'Take an ARIA accessibility snapshot'. YAML-format mention and 'without parsing HTML' distinguish from visual and evaluation tools.

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

Usage Guidelines3/5

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

Implied usage via 'Great for LLM-driven page understanding' but no explicit when-to-use or when-not-to-use compared to sibling tools like screenshot or evaluate.

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/yfe404/proxy-mcp'

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