Skip to main content
Glama

capture_screenshot

Capture and save Android device screenshots to a specific test folder for streamlined debugging and testing, using step-based naming for organized storage.

Instructions

Capture a screenshot and save it to the test folder

Input Schema

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

Implementation Reference

  • The main handler function for the capture_screenshot tool. It extracts test_name and step_name from args, constructs paths, ensures directory exists, executes adb screencap to save PNG, reads and base64 encodes it, returns text confirmation and image artifact.
    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 input schema and metadata definition for the capture_screenshot tool, used for tool listing and validation. Specifies required 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'], }, },

Other Tools

Related 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