write_clipboard
Copies text to your macOS clipboard using pbcopy, enabling quick sharing or saving of search results from web queries.
Instructions
Write the given text to the clipboard (macOS). Uses pbcopy.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes |
Implementation Reference
- server.py:78-89 (handler)The main handler function for the 'write_clipboard' MCP tool. It uses subprocess to call 'pbcopy' on macOS to write the provided text to the clipboard, decorated with @mcp.tool() for automatic registration and schema generation.@mcp.tool() def write_clipboard(text: str) -> str: """Write the given text to the clipboard (macOS). Uses `pbcopy`.""" try: completed = subprocess.run([ "bash", "-lc", "pbcopy" ], input=text, text=True, capture_output=True) if completed.returncode != 0: return f"❌ Failed to write clipboard (pbcopy exited {completed.returncode})." return "✅ Clipboard updated" except Exception as e: return f"❌ Error writing clipboard: {str(e)}"