Skip to main content
Glama
lewisvoncken

Playwright MCP

by lewisvoncken

browser_snapshot

Read-only

Capture accessibility snapshots of web pages to analyze content structure and elements for testing or documentation purposes.

Instructions

Capture accessibility snapshot of the current page, this is better than screenshot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNoSave snapshot to markdown file instead of returning it in the response.

Implementation Reference

  • Handler function for the browser_snapshot tool. Ensures a tab is active and instructs the system to capture an accessibility snapshot of the page.
    handle: async context => {
      await context.ensureTab();
    
      return {
        code: [`// <internal code to capture accessibility snapshot>`],
        captureSnapshot: true,
        waitForNetwork: false,
      };
    },
  • Schema definition for the browser_snapshot tool, including name, title, description, empty input schema (no parameters), and readOnly type.
    schema: {
      name: 'browser_snapshot',
      title: 'Page snapshot',
      description: 'Capture accessibility snapshot of the current page, this is better than screenshot',
      inputSchema: z.object({}),
      type: 'readOnly',
    },
  • src/tools.ts:36-52 (registration)
    Registration of browser_snapshot within the snapshotTools array by including exports from the snapshot module.
    export const snapshotTools: Tool<any>[] = [
      ...common(true),
      ...console,
      ...dialogs(true),
      ...files(true),
      ...install,
      ...keyboard(true),
      ...navigate(true),
      ...network,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs(true),
      ...testing,
      ...video,
      ...wait(true),
    ];
  • Final registration where snapshotTools (including browser_snapshot) are selected based on config and passed to the MCP server context and tool handlers.
    import { snapshotTools, visionTools } from './tools.js';
    import { packageJSON } from './package.js';
    
    import { FullConfig, validateConfig } from './config.js';
    
    import type { BrowserContextFactory } from './browserContextFactory.js';
    
    export function createConnection(config: FullConfig, browserContextFactory: BrowserContextFactory): Connection {
      const allTools = config.vision ? visionTools : snapshotTools;
      const tools = allTools.filter(tool => !config.capabilities || tool.capability === 'core' || config.capabilities.includes(tool.capability));
      validateConfig(config);
      const context = new Context(tools, config, browserContextFactory);
Behavior4/5

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

Annotations indicate readOnlyHint=true, destructiveHint=false, and openWorldHint=true, which the description doesn't contradict. The description adds valuable context beyond annotations by specifying it captures an 'accessibility snapshot' (implying structured data like ARIA roles or text content) and notes it can save to a markdown file via the filename parameter. However, it doesn't detail behavioral aspects like rate limits, authentication needs, or exact output format, keeping the score from being 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?

The description is a single, efficient sentence that front-loads the core purpose ('Capture accessibility snapshot of the current page') and adds a comparative note ('this is better than screenshot'). There is no wasted text, and it effectively communicates key information in a compact form, making it easy for an agent to parse quickly.

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?

Given the tool's moderate complexity (1 parameter, no output schema), the description is reasonably complete. It clarifies the tool's purpose and distinguishes it from a sibling, with annotations covering safety and scope. However, it could be more complete by explaining what an 'accessibility snapshot' includes (e.g., HTML structure, ARIA attributes) or when to prefer it over other tools, slightly reducing the score.

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?

The input schema has 1 parameter with 100% description coverage, documenting that 'filename' saves the snapshot to a markdown file instead of returning it in the response. The description adds no additional parameter semantics beyond this, as it doesn't explain the filename usage or format further. With high schema coverage, the baseline is 3, and the description doesn't compensate with extra details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool captures an accessibility snapshot of the current page, specifying both the action (capture) and resource (accessibility snapshot of current page). It distinguishes from the sibling 'browser_take_screenshot' by noting this is 'better than screenshot,' though it doesn't fully explain how it differs functionally. The purpose is specific but could be more explicit about what an 'accessibility snapshot' entails compared to a regular screenshot.

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?

The description implies usage by stating this is 'better than screenshot,' suggesting it as an alternative to 'browser_take_screenshot' for accessibility-focused captures. However, it lacks explicit guidance on when to use this tool versus others (e.g., for accessibility testing vs. visual documentation) or any prerequisites. The context is implied but not clearly defined, leaving some ambiguity for the agent.

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/lewisvoncken/playwright-mcp'

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