Skip to main content
Glama

screenshot

Capture full-page or element-specific screenshots for browser automation, enabling visual documentation and testing of web pages in the Autoconsent MCP server environment.

Instructions

Capture screenshots of the entire page or specific elements

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName for the screenshot
widthNoWidth in pixels (default: 1280)
heightNoHeight in pixels (default: 720)
encodedNoIf true, capture the screenshot as a base64-encoded data URI (as text) instead of binary image content. Default false.

Implementation Reference

  • Handler for the 'screenshot' tool: sets viewport dimensions, captures the page screenshot as base64 using Puppeteer, stores it in a global Map by name, notifies resource list change, returns confirmation text and the screenshot as image content or base64 data URI text based on 'encoded' parameter.
    case "screenshot": {
      const width = args.width ?? 1280;
      const height = args.height ?? 720;
      const encoded = args.encoded ?? false;
    
      await page.setViewport({ width, height });
    
      const screenshot = await page.screenshot({
        encoding: "base64",
        fullPage: false,
      });
    
      if (!screenshot) {
        return {
          content: [
            {
              type: "text",
              text: "Screenshot failed",
            },
          ],
          isError: true,
        };
      }
    
      screenshots.set(args.name, screenshot as string);
      server.notification({
        method: "notifications/resources/list_changed",
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Screenshot '${args.name}' taken at ${width}x${height}`,
          } as TextContent,
          encoded
            ? ({
                type: "text",
                text: `data:image/png;base64,${screenshot}`,
              } as TextContent)
            : ({
                type: "image",
                data: screenshot,
                mimeType: "image/png",
              } as ImageContent),
        ],
        isError: false,
      };
    }
  • Input schema and metadata (name, description) for the 'screenshot' tool, defining required 'name' and optional 'width', 'height', 'encoded' parameters.
      name: "screenshot",
      description: "Capture screenshots of the entire page or specific elements",
      inputSchema: {
        type: "object",
        properties: {
          name: { type: "string", description: "Name for the screenshot" },
          width: {
            type: "number",
            description: "Width in pixels (default: 1280)",
          },
          height: {
            type: "number",
            description: "Height in pixels (default: 720)",
          },
          encoded: {
            type: "boolean",
            description:
              "If true, capture the screenshot as a base64-encoded data URI (as text) instead of binary image content. Default false.",
          },
        },
        required: ["name"],
      },
    },
  • src/index.ts:588-590 (registration)
    Registers the 'screenshot' tool (via the TOOLS array) for listing with MCP clients through ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: TOOLS,
    }));
  • src/index.ts:592-594 (registration)
    Registers the tool execution dispatcher (handleToolCall containing screenshot case) via CallToolRequestSchema handler.
    server.setRequestHandler(CallToolRequestSchema, async (request) =>
      handleToolCall(request.params.name, request.params.arguments ?? {}),
    );
  • Global Map storing base64-encoded screenshot data by name, enabling persistence and retrieval as MCP resources (screenshot:// URIs).
    const screenshots = new Map<string, string>();
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 what the tool does but fails to describe critical traits such as whether it requires specific permissions, how it handles errors, if it modifies browser state, or what the output format looks like (e.g., file vs. data). This leaves significant gaps for a tool that interacts with browser content.

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 any redundant or unnecessary information. It's appropriately sized and front-loaded, 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.

Completeness2/5

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

Given the complexity of a screenshot tool (involving browser interaction and output handling), the description is incomplete. With no annotations and no output schema, it fails to address key aspects like the output format (e.g., image file, base64 string), error conditions, or dependencies on browser state, leaving the agent with insufficient context for reliable use.

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 schema description coverage is 100%, so the schema fully documents all four parameters. The description adds no additional meaning beyond what's in the schema, such as explaining the interaction between parameters or providing examples. This meets the baseline for high schema coverage.

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 ('capture screenshots') and specifies the scope ('entire page or specific elements'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'print_element' which might have overlapping functionality, preventing a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'print_element' or other sibling tools. It lacks context about use cases, prerequisites, or exclusions, leaving the agent with minimal direction for tool selection.

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/noisysocks/autoconsent-mcp'

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