Skip to main content
Glama
Nam0101

android-mcp-toolkit

take-screenshot

Capture Android device screenshots and save them to a local file path for development testing and debugging purposes.

Instructions

Capture device screenshot and save to a local file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outputPathYesLocal path to save the screenshot (e.g. screenshot.png)
timeoutMsNoTimeout in milliseconds

Implementation Reference

  • Zod input schema for the take-screenshot tool defining outputPath and optional timeoutMs.
    const screenshotSchema = z.object({ outputPath: z.string().min(1).describe('Local path to save the screenshot (e.g. screenshot.png)'), timeoutMs: z.number().int().min(1000).max(20000).default(10000).describe('Timeout in milliseconds') });
  • MCP server registration of the take-screenshot tool, including inline handler function that uses ADB screencap to capture and save PNG screenshot.
    server.registerTool( 'take-screenshot', { title: 'Take User Screenshot', description: 'Capture device screenshot and save to a local file.', inputSchema: screenshotSchema }, async (params) => { const buffer = await runAdbCommandBinary(['exec-out', 'screencap', '-p'], params.timeoutMs); const absPath = path.resolve(params.outputPath); fs.writeFileSync(absPath, buffer); return { content: [{ type: 'text', text: `Screenshot saved to ${absPath}` }] }; } );
  • Helper to run ADB binary commands (like screencap), returning buffer; used by take-screenshot handler.
    async function runAdbCommandBinary(args, timeoutMs) { try { const { stdout } = await execFileAsync('adb', args, { timeout: timeoutMs, encoding: 'buffer', maxBuffer: 20 * 1024 * 1024 }); return stdout; } catch (error) { throw new Error(`adb ${args.join(' ')} failed: ${error.message}`); } }

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/Nam0101/android-mcp-toolkit'

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