Skip to main content
Glama
TiagoDanin

Android Debug Bridge MCP

by TiagoDanin

capture_ui_dump

Capture UI hierarchy dumps from Android devices for debugging and testing purposes. Analyze app layouts and identify UI elements through ADB automation.

Instructions

Capture UI hierarchy dump from the device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'capture_ui_dump' tool. It calls the captureUIContent helper with raw XML included and returns the formatted content.
    capture_ui_dump: async (args: any) => {
      const content = await captureUIContent(true);
      return {
        content: content,
      };
    },
  • The core helper function that performs the ADB UI dump, parses the XML using parseUIAutomatorXML, formats it, and constructs the response content including optional raw XML.
    const captureUIContent = async (includeRawXML: boolean = true) => {
      await executeCommand('adb shell uiautomator dump /sdcard/window_dump.xml');
      const xmlContent = await executeCommand('adb shell "cat /sdcard/window_dump.xml"');
      
      try {
        const processedUI = await parseUIAutomatorXML(xmlContent);
        const formattedOutput = formatElementsForDisplay(processedUI);
        
        const result = [
          {
            type: 'text',
            text: formattedOutput,
          },
        ];
        
        if (includeRawXML) {
          result.push({
            type: 'text',
            text: `\n=== RAW XML UI Automator ===\n${xmlContent}`,
          });
        }
        
        return result;
      } catch (error) {
        const result = [
          {
            type: 'text',
            text: `Error processing UI dump: ${error}`,
          },
          {
            type: 'text',
            text: `\n=== RAW XML DATA ===\n${xmlContent}`,
          }
        ];
      
        
        return result;
      }
    };
  • The schema definition for the 'capture_ui_dump' tool, specifying no input parameters.
    {
      name: 'capture_ui_dump',
      description: 'Capture UI hierarchy dump from the device',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • src/index.ts:26-30 (registration)
    Tool list registration that exposes the toolDefinitions array, including the capture_ui_dump schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: toolDefinitions,
      };
    });
  • src/index.ts:32-46 (registration)
    Tool execution registration that looks up and invokes the handler from toolHandlers based on tool name, enabling capture_ui_dump execution.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      try {
        const handler = toolHandlers[name as keyof typeof toolHandlers];
        if (!handler) {
          throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
        }
    
        return await handler(args);
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${errorMessage}`);
      }
    });
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 states what the tool does but doesn't describe behavioral traits such as whether it requires device connectivity, if it's read-only or has side effects, latency expectations, or output format. For a tool with zero annotation coverage, this is a significant gap in transparency.

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, clear sentence with no wasted words. It's front-loaded with the core purpose and efficiently communicates the essential action without unnecessary elaboration, 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 lack of annotations and output schema, the description is incomplete for a tool that likely interacts with device UI. It doesn't explain what a 'UI hierarchy dump' entails, how the output is structured, or any behavioral context (e.g., device requirements). For a tool with no structured data support, the description should provide more completeness.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't add parameter details beyond what the schema provides, earning a baseline score of 4 for tools with zero parameters.

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') and resource ('UI hierarchy dump from the device'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'capture_screenshot' (which likely captures visual output rather than hierarchy data), leaving room for improvement in sibling distinction.

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, context (e.g., device state), or comparisons to siblings like 'capture_screenshot' or 'list_apps', leaving the agent to infer usage scenarios without explicit direction.

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/TiagoDanin/Android-Debug-Bridge-MCP'

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