read_clipboard
Retrieve text content from your system clipboard to access copied information across Linux, macOS, Windows, and WSL platforms.
Instructions
Read the current text content from the system clipboard.
Returns the text currently stored in the clipboard. If the clipboard is empty or contains non-text data, an empty string is returned.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- clipboard_mcp/__init__.py:19-33 (handler)The handler function for the 'read_clipboard' tool. It reads the system clipboard content using pyperclip.paste(), handles exceptions by raising a RuntimeError, and returns the content or an empty string.@mcp.tool() def read_clipboard() -> str: """Read the current text content from the system clipboard. Returns the text currently stored in the clipboard. If the clipboard is empty or contains non-text data, an empty string is returned. """ try: content = pyperclip.paste() except pyperclip.PyperclipException as e: msg = f"Failed to read clipboard: {e}" raise RuntimeError(msg) from e else: return content if content else ""
- clipboard_mcp/__init__.py:19-19 (registration)Registers the read_clipboard tool on the FastMCP instance using the @mcp.tool() decorator.@mcp.tool()