take_screenshot
Capture and retrieve screenshots of a user's screen for AI-driven analysis and assistance using the MCP interface.
Instructions
Take a screenshot of the user's screen and return it as an image
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Core implementation of the take_screenshot tool: captures screen using pyautogui, converts to JPEG, and returns as MCP Image object.def take_screenshot() -> Image: """ Take a screenshot of the user's screen and return it as an image. Use this tool anytime the user wants to look at something they're doing. """ import pyautogui buffer = io.BytesIO() # if the file exceeds ~1MB, it will be rejected by Claude screenshot = pyautogui.screenshot() screenshot.convert("RGB").save(buffer, format="JPEG", quality=60, optimize=True) return Image(data=buffer.getvalue(), format="jpeg")
- screenshot_mcp_server/server/app.py:40-47 (registration)Registers the 'take_screenshot' MCP tool with a thin wrapper handler that delegates to the core implementation.@mcp_server.tool( name="take_screenshot", description="Take a screenshot of the user's screen and return it as an image", ) def screenshot_tool() -> Image: """Wrapper around the screenshot tool implementation""" return take_screenshot()
- Import of the take_screenshot function used by the tool handler.from screenshot_mcp_server.tools.screenshot import take_screenshot