Skip to main content
Glama

take_screenshot

Capture JPEG screenshots from iOS Simulators with configurable compression, resolution limits, and unchanged-image detection for automation workflows.

Instructions

Take a JPEG screenshot with optional compression and unchanged-image suppression.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidNoSimulator UDID (optional, defaults to booted simulator)
max_dimNoMax width/height for output image (default: 960)
qualityNoJPEG quality 20..95 (default: 60)
only_if_changedNoDo not return image content if hash is unchanged
previous_image_hashNoCompare against this hash for unchanged detection

Implementation Reference

  • The `takeScreenshot` private method in `src/index.ts` is the handler that performs the screenshot operation and returns the MCP tool response.
    private async takeScreenshot(
      udid?: string,
      maxDimInput?: number,
      qualityInput?: number,
      onlyIfChanged?: boolean,
      previousImageHash?: string
    ) {
      const target = await resolveUdid(udid);
      const options = normalizeScreenshotOptions(maxDimInput, qualityInput);
    
      try {
        const shot = await this.captureScreenshot(target, options);
    
        const compareHash = previousImageHash ?? (
          onlyIfChanged ? this.lastScreenshotHashByUdid.get(target) : undefined
        );
        const changed = compareHash ? compareHash !== shot.hash : true;
    
        this.lastScreenshotHashByUdid.set(target, shot.hash);
    
        const meta = {
          udid: target,
          hash: shot.hash,
          previous_hash: compareHash ?? null,
          changed,
          included: changed,
          source_width: shot.sourceWidth,
          source_height: shot.sourceHeight,
          sent_width: shot.sentWidth,
          sent_height: shot.sentHeight,
          max_dim: shot.maxDim,
          quality: shot.quality,
        };
    
        const content: any[] = [{ type: 'text', text: JSON.stringify(meta, null, 2) }];
        if (changed) {
          content.push({ type: 'image', data: shot.base64, mimeType: 'image/jpeg' });
        }
    
        return { content };
  • src/index.ts:336-336 (registration)
    The `take_screenshot` tool is registered in the list of available MCP tools within the initialization of the server in `src/index.ts`.
    name: 'take_screenshot',
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 optional compression and unchanged-image suppression, which adds some context beyond basic functionality. However, it lacks critical details: it doesn't specify what happens on success (e.g., returns image data), error conditions, permissions needed, or side effects (e.g., whether it affects simulator state). For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 front-loads the core action ('Take a JPEG screenshot') and concisely adds key optional features. Every word earns its place, with no redundancy or fluff, 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 (a 5-parameter tool with no annotations and no output schema), the description is incomplete. It doesn't explain the return value (e.g., image data or error), error handling, or dependencies on other tools (e.g., requiring a booted simulator). While the schema covers parameters well, the lack of behavioral and output information leaves the agent without sufficient 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?

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds minimal value beyond the schema: it references 'optional compression' (mapping to quality parameter) and 'unchanged-image suppression' (mapping to only_if_changed and previous_image_hash), but doesn't provide additional syntax, format, or usage context. This meets the baseline for high schema coverage, where the description isn't needed for parameter documentation.

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

Purpose5/5

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

The description clearly states the specific action ('Take a JPEG screenshot') and distinguishes it from siblings by focusing on image capture rather than simulator control, UI interaction, or app management. It specifies the output format (JPEG) and key optional behaviors (compression, unchanged-image suppression), making the purpose unambiguous and distinct from tools like get_screen_summary or get_ui_tree.

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., needing a booted simulator), compare it to siblings like get_screen_summary (which might provide textual data instead of images), or specify scenarios where screenshot capture is appropriate over other UI inspection tools. Usage is implied only by the tool's name and purpose.

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/xmuweili/app-screen-mcp'

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