Skip to main content
Glama
TiagoDanin

Android Debug Bridge MCP

by TiagoDanin

capture_screenshot

Capture screenshots from Android devices during testing and save them to designated test folders for documentation and debugging purposes.

Instructions

Capture a screenshot and save it to the test folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
test_nameYesName of the test folder where to save the screenshot
step_nameYesName of the step for the screenshot file (e.g., "001_login")

Implementation Reference

  • The main handler function that implements the capture_screenshot tool logic. Uses ADB screencap to capture and save the screenshot, then returns it as base64-encoded image.
    capture_screenshot: async (args: any) => {
      const { test_name, step_name } = args as { 
        test_name: string; 
        step_name: string; 
      };
      
      const testPath = path.join(getBaseTestPath(), test_name);
      const screenshotPath = path.join(testPath, `${step_name}_step.png`);
      
      if (!fs.existsSync(testPath)) {
        fs.mkdirSync(testPath, { recursive: true });
      }
      
      await executeCommand(`adb exec-out screencap -p > "${screenshotPath}"`);
      
      // Read the screenshot file and convert to base64
      const imageData = fs.readFileSync(screenshotPath);
      const base64Image = imageData.toString('base64');
      
      return {
        content: [
          {
            type: 'text',
            text: `Screenshot captured: ${screenshotPath}`,
          },
          {
            type: 'image',
            data: base64Image,
            mimeType: 'image/png',
          },
        ],
      };
    },
  • The schema definition for the capture_screenshot tool, including input parameters test_name and step_name.
    {
      name: 'capture_screenshot',
      description: 'Capture a screenshot and save it to the test folder',
      inputSchema: {
        type: 'object',
        properties: {
          test_name: {
            type: 'string',
            description: 'Name of the test folder where to save the screenshot',
          },
          step_name: {
            type: 'string',
            description: 'Name of the step for the screenshot file (e.g., "001_login")',
          },
        },
        required: ['test_name', 'step_name'],
      },
    },
  • src/index.ts:32-46 (registration)
    Registration of tool handlers via MCP server's CallToolRequestSchema. Looks up handler from toolHandlers object by tool name.
    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}`);
      }
    });
  • src/index.ts:26-30 (registration)
    Registration of tool schemas via MCP server's ListToolsRequestSchema. Returns the toolDefinitions array containing the schema for capture_screenshot.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: toolDefinitions,
      };
    });
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 states the tool captures and saves a screenshot, implying a read-only operation that creates a file, but it doesn't disclose critical details such as file format, permissions needed, whether it overwrites existing files, error conditions, or any side effects. This leaves significant gaps for an agent to understand the tool's 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 directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 of a screenshot tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., file handling, errors), usage context, and output information, which are essential for an agent to use the tool effectively in a testing environment with multiple sibling tools.

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%, with clear descriptions for both parameters in the input schema. The description adds no additional meaning beyond what the schema provides, as it doesn't explain parameter relationships or usage examples. However, with high schema coverage, a baseline score of 3 is appropriate since the schema adequately documents the 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 a screenshot') and the outcome ('save it to the test folder'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from sibling tools like 'capture_ui_dump' or 'create_test_folder', which might have overlapping purposes in a testing context.

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 an active app or test folder), exclusions, or how it relates to siblings like 'capture_ui_dump' for different types of captures or 'create_test_folder' for folder setup.

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