Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

screenshot

Capture browser screenshots for web automation tasks. Specify viewport, element, or full page captures with Playwright integration.

Instructions

Take a screenshot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
typeNo
selectorNo

Implementation Reference

  • Core implementation of the screenshot tool in PlaywrightController. Handles screenshot types: element, viewport, full page. Uses Playwright API to capture and save to path.
    async screenshot(options: ScreenshotOptions): Promise<void> {
      try {
        if (!this.isInitialized() || !this.state.page) {
          throw new Error('Browser not initialized');
        }
        this.log('Taking screenshot', options);
        
        if (options.type === 'element' && options.selector) {
          const element = await this.state.page.$(options.selector);
          if (!element) {
            throw new Error('Element not found');
          }
          await element.screenshot({ path: options.path });
        } else if (options.type === 'viewport') {
          await this.state.page.screenshot({ path: options.path });
        } else {
          await this.state.page.screenshot({ path: options.path, fullPage: true });
        }
        
        this.log('Screenshot saved to', options.path);
      } catch (error: any) {
        console.error('Screenshot error:', error);
        throw new BrowserError(
          'Failed to take screenshot',
          'Check if the path is writable and element exists (if capturing element)'
        );
      }
    }
  • MCP Tool schema for 'screenshot' defining input parameters: path (required), type (viewport/element/page), selector.
    const SCREENSHOT_TOOL: Tool = {
      name: "screenshot",
      description: "Take a screenshot",
      inputSchema: {
        type: "object",
        properties: {
          path: { type: "string" },
          type: { type: "string", enum: ["viewport", "element", "page"] },
          selector: { type: "string" }
        },
        required: ["path"]
      }
    };
  • src/server.ts:521-521 (registration)
    Registration of SCREENSHOT_TOOL in the tools dictionary provided to MCP server capabilities.
    screenshot: SCREENSHOT_TOOL,
  • MCP callTool dispatch case for 'screenshot' tool: validates path arg and calls playwrightController.screenshot.
    case 'screenshot': {
      if (!args.path) {
        return {
          content: [{ type: "text", text: "Path is required" }],
          isError: true
        };
      }
      await playwrightController.screenshot(args as any);
      return {
        content: [{ type: "text", text: "Screenshot taken successfully" }]
      };
    }
  • TypeScript interface defining ScreenshotOptions for type safety in the handler.
    export interface ScreenshotOptions {
      path: string;
      type?: 'element' | 'page' | 'viewport';
      selector?: string;
    }
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Take a screenshot' implies a read-only operation that captures visual data, but it doesn't disclose any behavioral traits such as what happens if the path is invalid, whether it requires an active browser session, potential side effects, or how it interacts with the browser state. This is inadequate for a tool with parameters and 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 extremely concise with just two words, 'Take a screenshot', which is front-loaded and wastes no space. Every word earns its place by stating the core action, though it's under-specified rather than concise in a helpful way.

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

Completeness1/5

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

Given the complexity (3 parameters, 0% schema coverage, no annotations, no output schema, and sibling tools including 'takeScreenshot'), the description is incomplete. It doesn't explain what the tool returns, how parameters work, or differentiate it from similar tools. For a browser automation tool with multiple parameters, this is severely inadequate.

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

Parameters1/5

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

The input schema has 3 parameters with 0% description coverage, meaning none of the parameters are documented in the schema. The description 'Take a screenshot' adds no meaning beyond what the schema provides—it doesn't explain what 'path', 'type', or 'selector' mean, their formats, or how they affect the screenshot. With low schema coverage, the description fails to compensate.

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

Purpose2/5

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

The description 'Take a screenshot' is a tautology that essentially restates the tool name 'screenshot'. It specifies the verb 'take' and resource 'screenshot', but doesn't distinguish from the sibling tool 'takeScreenshot' (which appears to be a duplicate or similar tool in the sibling list). The purpose is clear at a basic level but lacks differentiation from alternatives.

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

Usage Guidelines1/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. There is no mention of context, prerequisites, or exclusions. With sibling tools like 'takeScreenshot' (which may be similar or identical) and other browser automation tools, this lack of guidance is particularly problematic.

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/jomon003/PlayMCP'

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