Skip to main content
Glama

get_screen_summary

Extract UI tree and screenshots from iOS simulators to analyze app interfaces, with options to optimize token usage and detect visual changes.

Instructions

Get screen context (UI tree and optional screenshot) with token-saving options.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidNoSimulator UDID (optional, defaults to booted simulator)
include_imageNoInclude screenshot image content (default: true)
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
compact_treeNoReturn compact tree format for fewer tokens

Implementation Reference

  • The 'getScreenSummary' method acts as the handler for the 'get_screen_summary' MCP tool. It resolves the target device, fetches the UI tree, and optionally captures a screenshot based on provided parameters.
    private async getScreenSummary(
      udid?: string,
      includeImage?: boolean,
      maxDimInput?: number,
      qualityInput?: number,
      onlyIfChanged?: boolean,
      previousImageHash?: string,
      compactTree?: boolean
    ) {
      const target = await resolveUdid(udid);
      const shouldIncludeImage = includeImage !== false;
      const options = normalizeScreenshotOptions(maxDimInput, qualityInput);
    
      const promises: Promise<any>[] = [this.fetchUiTree(target)];
      if (shouldIncludeImage) {
        promises.push(this.captureScreenshot(target, options));
      }
    
      const settled = await Promise.allSettled(promises);
      const treeResult = settled[0];
      const screenshotResult = shouldIncludeImage ? settled[1] : undefined;
    
      const meta: Record<string, any> = {
        timestamp: Date.now(),
        udid: target,
        include_image: shouldIncludeImage,
        compact_tree: compactTree === true,
      };
    
      if (treeResult.status === 'fulfilled') {
        const elements = treeResult.value as UIElement[];
        meta.element_count = elements.length;
        meta.elements = compactTree === true ? this.compactElements(elements) : elements;
      } else {
        meta.ui_tree_error = String(treeResult.reason?.message ?? treeResult.reason);
      }
    
      const content: any[] = [{ type: 'text', text: JSON.stringify(meta, null, 2) }];
    
      if (shouldIncludeImage && screenshotResult) {
        if (screenshotResult.status === 'fulfilled') {
          const shot = screenshotResult.value as ScreenshotPayload;
          const compareHash = previousImageHash ?? (
            onlyIfChanged ? this.lastScreenshotHashByUdid.get(target) : undefined
  • src/index.ts:351-368 (registration)
    The 'get_screen_summary' tool is defined and registered with its schema (description and input parameters) within the MCP tool list.
      name: 'get_screen_summary',
      description: 'Get screen context (UI tree and optional screenshot) with token-saving options.',
      inputSchema: {
        type: 'object',
        properties: {
          udid: { type: 'string', description: 'Simulator UDID (optional, defaults to booted simulator)' },
          include_image: { type: 'boolean', description: 'Include screenshot image content (default: true)' },
          max_dim: { type: 'number', description: 'Max width/height for output image (default: 960)' },
          quality: { type: 'number', description: 'JPEG quality 20..95 (default: 60)' },
          only_if_changed: { type: 'boolean', description: 'Do not return image content if hash is unchanged' },
          previous_image_hash: { type: 'string', description: 'Compare against this hash for unchanged detection' },
          compact_tree: { type: 'boolean', description: 'Return compact tree format for fewer tokens' },
        },
        additionalProperties: false,
      },
    },
    
    // Interaction
Behavior2/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. It mentions 'token-saving options' but does not explain what this entails (e.g., how compact_tree reduces tokens, implications of only_if_changed). It lacks details on permissions, rate limits, error handling, or what the output looks like (UI tree format, image data). For a tool with 7 parameters and no annotations, this is insufficient.

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 purpose ('Get screen context') and adds a key feature ('with token-saving options'). There is no wasted verbiage or redundancy, making it highly concise and well-structured.

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 tool's complexity (7 parameters, no annotations, no output schema), the description is incomplete. It does not explain the output format (e.g., structure of UI tree, image encoding), error conditions, or how token-saving options affect behavior. For a tool that retrieves screen context with multiple configuration options, more context is needed to guide effective 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 input schema has 100% description coverage, so the schema already documents all parameters thoroughly. The description adds no additional semantic context beyond implying token optimization via 'compact_tree' and 'only_if_changed', but it does not explain parameter interactions or usage scenarios. Baseline 3 is appropriate as the schema does the 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 tool's purpose: 'Get screen context (UI tree and optional screenshot)' which specifies the verb ('Get') and resource ('screen context'). It distinguishes itself from siblings like 'get_ui_tree' and 'take_screenshot' by offering both UI tree and screenshot capabilities with token-saving options, though it could be more explicit about the differentiation.

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 minimal guidance on when to use this tool. It mentions 'token-saving options' but does not specify when to choose this over alternatives like 'get_ui_tree' or 'take_screenshot', nor does it outline prerequisites or exclusions. No explicit when/when-not or alternative recommendations are provided.

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