Skip to main content
Glama

mobile_save_screenshot

Capture and save screenshots from mobile devices for automation testing and debugging purposes. Specify device identifier and file path to store the image.

Instructions

Save a screenshot of the mobile device to a file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYesThe device identifier to use. Use mobile_list_available_devices to find which devices are available to you.
saveToYesThe path to save the screenshot to

Implementation Reference

  • src/server.ts:384-397 (registration)
    Registration of the 'mobile_save_screenshot' tool, including input schema (saveTo path) and inline handler that uses the selected robot to capture and save a screenshot to the specified file path.
    tool(
    	"mobile_save_screenshot",
    	"Save a screenshot of the mobile device to a file",
    	{
    		saveTo: z.string().describe("The path to save the screenshot to"),
    	},
    	async ({ saveTo }) => {
    		requireRobot();
    
    		const screenshot = await robot!.getScreenshot();
    		fs.writeFileSync(saveTo, screenshot);
    		return `Screenshot saved to: ${saveTo}`;
    	}
    );
  • The handler function for 'mobile_save_screenshot' is defined inline during registration. It requires a selected robot/device, captures the screenshot buffer via robot.getScreenshot(), and writes it synchronously to the filesystem using fs.writeFileSync.
    tool(
    	"mobile_save_screenshot",
    	"Save a screenshot of the mobile device to a file",
    	{
    		saveTo: z.string().describe("The path to save the screenshot to"),
    	},
    	async ({ saveTo }) => {
    		requireRobot();
    
    		const screenshot = await robot!.getScreenshot();
    		fs.writeFileSync(saveTo, screenshot);
    		return `Screenshot saved to: ${saveTo}`;
    	}
    );
  • Input schema for 'mobile_save_screenshot' tool: requires a 'saveTo' string parameter specifying the file path.
    saveTo: z.string().describe("The path to save the screenshot to"),

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/EmpathySlainLovers/MCP'

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