Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export const createMcpServer = (): McpServer => {
}
);

server.tool(
tool(
"mobile_take_screenshot",
"Take a screenshot of the mobile device. Use this to understand what's on screen, if you need to press an element that is available through view hierarchy then you must list elements on screen instead. Do not cache this result.",
{
Expand Down Expand Up @@ -432,15 +432,10 @@ export const createMcpServer = (): McpServer => {
const screenshot64 = screenshot.toString("base64");
trace(`Screenshot taken: ${screenshot.length} bytes`);

return {
content: [{ type: "image", data: screenshot64, mimeType }]
};
return `data:${mimeType};base64,${screenshot64}`;
} catch (err: any) {
error(`Error taking screenshot: ${err.message} ${err.stack}`);
return {
content: [{ type: "text", text: `Error: ${err.message}` }],
isError: true,
};
throw new ActionableError(`Error taking screenshot: ${err.message}`);
}
}
);
Expand Down