Skip to main content
Glama
cloudflare

Cloudflare Playwright MCP

Official
by cloudflare

browser_snapshot

Read-only

Capture accessibility snapshots of web pages using Playwright for enhanced testing and analysis beyond standard screenshots, integrated with Cloudflare Workers for browser automation.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'browser_snapshot' tool. It ensures a tab is active and returns a response instructing 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,
      };
    },
  • Input schema and metadata definition for the 'browser_snapshot' tool using Zod. It has no input parameters and is marked as read-only.
    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:35-50 (registration)
    Registers the 'browser_snapshot' tool by spreading the imported 'snapshot' module into the main 'snapshotTools' array, which collects all core tools.
    export const snapshotTools: Tool<any>[] = [
      ...common(true),
      ...console,
      ...dialogs(true),
      ...files(true),
      ...install,
      ...keyboard(true),
      ...navigate(true),
      ...network,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs(true),
      ...testing,
      ...wait(true),
    ];
  • Module-level registration exporting 'browser_snapshot' (named 'snapshot') along with related browser interaction tools.
    export default [
      snapshot,
      click,
      drag,
      hover,
      type,
      selectOption,
    ];
Behavior4/5

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

Annotations provide readOnlyHint=true, destructiveHint=false, and openWorldHint=true, indicating a safe, non-destructive operation with open-ended results. The description adds value by specifying it captures an 'accessibility snapshot' (implying structured data like ARIA roles or contrast ratios) and compares it to screenshots, offering context beyond annotations. No contradiction with annotations is present.

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 action ('Capture accessibility snapshot of the current page') and adds a comparative note ('this is better than screenshot') for context. Every word earns its place with no redundancy or fluff, making it highly concise and well-structured.

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 0 parameters, rich annotations (readOnlyHint, destructiveHint, openWorldHint), and no output schema, the description is reasonably complete. It explains what the tool does and offers a key comparison, though it could enhance completeness by briefly mentioning the output format (e.g., JSON structure) or typical use cases, given the openWorldHint suggests varied results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing on tool behavior. A baseline of 4 is applied as it compensates for the lack of parameters by explaining the tool's purpose clearly.

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 verb ('Capture') and resource ('accessibility snapshot of the current page'), making the purpose specific and understandable. It distinguishes from sibling 'browser_take_screenshot' by comparing functionality, though it doesn't explicitly name all relevant siblings like 'browser_evaluate' or 'browser_console_messages' for broader context.

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 comparing to 'browser_take_screenshot' ('this is better than screenshot'), suggesting when to prefer this tool over that specific alternative. However, it lacks explicit guidance on when to use it versus other siblings like 'browser_evaluate' or 'browser_console_messages', and doesn't mention prerequisites or exclusions, leaving some context gaps.

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

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

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