Skip to main content
Glama

browser_screenshot

Capture screenshots of web pages or specific elements using parallel browser instances for testing, documentation, or monitoring purposes.

Instructions

Take a screenshot of the page or element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceIdYesInstance ID
fullPageNoWhether to capture the full page
selectorNoElement selector (capture specific element)
typeNoImage formatpng
qualityNoImage quality (1-100, JPEG only)

Implementation Reference

  • Core handler implementation that captures screenshot of the entire page or a specific element using Playwright APIs, returns base64 encoded image.
    private async screenshot(instanceId: string, options: ScreenshotOptions, selector?: string): Promise<ToolResult> {
      const instance = this.browserManager.getInstance(instanceId);
      if (!instance) {
        return { success: false, error: `Instance ${instanceId} not found` };
      }
    
      try {
        let screenshotData: Buffer;
        
        if (selector) {
          const element = await instance.page.$(selector);
          if (!element) {
            return { success: false, error: `Element not found: ${selector}`, instanceId };
          }
          screenshotData = await element.screenshot({
            type: options.type,
            quality: options.type === 'jpeg' ? options.quality : undefined
          });
        } else {
          screenshotData = await instance.page.screenshot({
            fullPage: options.fullPage,
            type: options.type,
            quality: options.type === 'jpeg' ? options.quality : undefined,
            clip: options.clip
          });
        }
    
        return {
          success: true,
          data: { 
            screenshot: screenshotData.toString('base64'),
            type: options.type,
            selector
          },
          instanceId
        };
      } catch (error) {
        return {
          success: false,
          error: `Screenshot failed: ${error instanceof Error ? error.message : error}`,
          instanceId
        };
      }
    }
  • src/tools.ts:359-394 (registration)
    Tool definition and registration in BrowserTools.getTools(), including name, description, and detailed input JSON schema.
    {
      name: 'browser_screenshot',
      description: 'Take a screenshot of the page or element',
      inputSchema: {
        type: 'object',
        properties: {
          instanceId: {
            type: 'string',
            description: 'Instance ID'
          },
          fullPage: {
            type: 'boolean',
            description: 'Whether to capture the full page',
            default: false
          },
          selector: {
            type: 'string',
            description: 'Element selector (capture specific element)'
          },
          type: {
            type: 'string',
            enum: ['png', 'jpeg'],
            description: 'Image format',
            default: 'png'
          },
          quality: {
            type: 'number',
            description: 'Image quality (1-100, JPEG only)',
            minimum: 1,
            maximum: 100,
            default: 80
          }
        },
        required: ['instanceId']
      }
    },
  • Dispatcher in executeTools method that routes the tool call to the screenshot handler with parsed arguments.
    case 'browser_screenshot':
      return await this.screenshot(args.instanceId, {
        fullPage: args.fullPage || false,
        type: args.type || 'png',
        quality: args.quality || 80
      }, args.selector);
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action but lacks details on behavioral traits: it doesn't specify output format (e.g., base64 string, file path), error conditions, permissions needed, or side effects. This is a significant gap for a tool with no annotation coverage.

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, clear sentence with zero waste. It's front-loaded and efficiently conveys the core purpose without unnecessary words.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., image data, success status) or address potential complexities like handling missing elements or instance errors. For a 5-parameter tool with behavioral implications, this is inadequate.

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 parameters are well-documented in the schema. The description adds minimal value beyond schema, only implying 'page or element' maps to fullPage and selector parameters. Baseline 3 is appropriate as schema does heavy lifting.

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 ('Take a screenshot') and target ('page or element'), which is specific and distinguishes it from siblings like browser_click or browser_type. However, it doesn't explicitly differentiate from other screenshot-related tools (none exist in siblings), so it's not a perfect 5.

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. It doesn't mention prerequisites (e.g., needing an active browser instance), exclusions, or comparisons with other tools. The description is standalone without context.

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/sailaoda/concurrent-browser-mcp'

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