Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

getImages

Extract all images from web pages for web scraping, testing, or content analysis using browser automation.

Instructions

Get all images from the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that executes the getImages tool logic by evaluating JavaScript in the browser context to extract image elements' attributes.
    async getImages(): Promise<Array<{src: string, alt?: string, title?: string, width?: number, height?: number}>> {
      try {
        if (!this.isInitialized()) {
          throw new Error('Browser not initialized');
        }
        this.log('Getting page images');
        const images = await this.state.page?.evaluate(() => {
          const imgElements = Array.from(document.querySelectorAll('img'));
          return imgElements.map(img => ({
            src: (img as HTMLImageElement).src,
            alt: img.getAttribute('alt') || undefined,
            title: img.getAttribute('title') || undefined,
            width: (img as HTMLImageElement).naturalWidth || undefined,
            height: (img as HTMLImageElement).naturalHeight || undefined
          }));
        });
        this.log('Images retrieved:', images?.length);
        return images || [];
      } catch (error: any) {
        console.error('Get images error:', error);
        throw new BrowserError('Failed to get images', 'Check if the page is loaded');
      }
    }
  • Defines the tool schema including name, description, and empty input schema (no parameters required).
    const GET_IMAGES_TOOL: Tool = {
      name: "getImages",
      description: "Get all images from the current page",
      inputSchema: {
        type: "object",
        properties: {},
        required: []
      }
    };
  • src/server.ts:530-530 (registration)
    Registers the getImages tool in the tools dictionary used for MCP capabilities.
    getImages: GET_IMAGES_TOOL,
  • src/server.ts:733-738 (registration)
    Dispatches the tool call to the playwrightController.getImages() handler in the MCP request handler.
    case 'getImages': {
      const images = await playwrightController.getImages();
      return {
        content: [{ type: "text", text: JSON.stringify(images, null, 2) }]
      };
    }
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 but offers minimal insight. It implies a read-only operation ('Get') but doesn't specify return format, pagination, error conditions, or dependencies (e.g., browser state). This is inadequate for a tool with zero annotation coverage, as critical behavioral traits are omitted.

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, front-loaded sentence with zero waste—every word contributes to understanding the tool's purpose. It efficiently communicates the core functionality without redundancy or fluff, making it ideal for quick comprehension by an AI agent.

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 lack of annotations and output schema, the description is incomplete for effective tool use. It doesn't explain what 'images' includes (e.g., list of URLs, image data), how results are structured, or any limitations (e.g., only visible images). For a tool in a browser automation context with many siblings, this leaves significant gaps in understanding.

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 zero parameters, and the input schema coverage is 100%, so no parameter documentation is needed. The description appropriately avoids discussing parameters, focusing solely on the tool's purpose. A baseline of 4 is applied since no parameters exist, and the description doesn't add unnecessary details.

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') and resource ('images from the current page'), making the purpose immediately understandable. It distinguishes itself from siblings like getLinks or getMetaTags by specifying images. However, it lacks specificity about what 'images' entails (e.g., URLs, metadata, content), 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. It doesn't mention prerequisites (e.g., requiring an open browser page), exclusions, or comparisons to similar tools like getPageSource or screenshot, leaving the agent to infer context from the tool name alone.

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