Skip to main content
Glama

snapshot

Capture a snapshot of the current webpage including all interactive elements for documentation, testing, or analysis purposes.

Instructions

Get a snapshot of the current page with interactive elements

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler method that captures the page snapshot including URL, title, and interactive elements by evaluating JavaScript on the page.
    async snapshot() {
      await this.ensureLaunched();
      
      // Get basic page information
      const url = await this.getUrl();
      const title = await this.getTitle();
      
      // Extract all interactive elements from the page
      const elements = await this.page.evaluate(() => {
        const interactive = document.querySelectorAll('a, button, input, select, textarea, [onclick], [role="button"]');
        return Array.from(interactive).map((el, index) => ({
          index,
          tag: el.tagName.toLowerCase(),
          text: el.textContent?.trim() || el.value || el.placeholder || '',
          type: el.type || '',
          role: el.getAttribute('role') || '',
          id: el.id || '',
          className: el.className || ''
        }));
      });
    
      // Return page snapshot with filtered interactive elements
      return {
        url,
        title,
        elements: elements.filter(el => el.text || el.id || el.className)
      };
    }
  • Registers the 'snapshot' MCP tool with input schema and a handler that calls the browser.snapshot() method and formats the response.
    {
      name: 'snapshot',
      description: 'Get a snapshot of the current page with interactive elements',
      inputSchema: {
        type: 'object',
        properties: {},
        required: []
      },
      handler: async () => {
        const snapshot = await browser.snapshot();
        return { 
          success: true, 
          data: snapshot,
          message: `Page snapshot captured for ${snapshot.url}`
        };
      }
    },
  • Input schema for the 'snapshot' tool, which requires no parameters.
    inputSchema: {
      type: 'object',
      properties: {},
      required: []
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions capturing interactive elements, but doesn't clarify what 'snapshot' entails (e.g., is it a visual image, DOM state, or something else?), whether it requires page stability, or what the output format is. This leaves significant gaps for a tool that likely involves page interaction.

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 directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity of capturing page snapshots with interactive elements, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'snapshot' means in this context, how interactive elements are handled, or what the agent can expect as a result, leaving critical behavioral aspects unclear.

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 tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it appropriately avoids mentioning any. This meets the baseline for a parameterless tool.

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 action ('Get a snapshot') and target ('current page'), with the additional detail 'with interactive elements' that distinguishes it from a basic screenshot. However, it doesn't explicitly differentiate from the 'screenshot' sibling tool, which might capture similar visual content.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'screenshot' or 'get_text'. The description implies it captures interactive elements, but doesn't specify scenarios where this is preferred or when other tools might be more appropriate.

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/zypin-testing/zypin-mcp'

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