take_screenshot
Capture screen content as an image to enable AI assistants to see and analyze what users are viewing through a simple 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 handler function that implements the screenshot capture logic using pyautogui, processes the image into a JPEG buffer, and returns it as an 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 the server, providing the name, description, and a thin wrapper function 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()