copy_to_clipboard
Copies provided text to the system clipboard, enabling quick data transfer for AI assistants.
Instructions
Copy text to the clipboard.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes |
Implementation Reference
- src/server.py:41-50 (handler)The copy_to_clipboard tool handler function. Uses pyperclip.copy() to copy text to the system clipboard. Decorated with @mcp.tool which handles both registration and annotations.
@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True)) def copy_to_clipboard(text: str) -> str: """ Copy text to the clipboard. """ try: pyperclip.copy(text) return "Text copied to clipboard successfully." except Exception as e: return f"Error copying text to clipboard: {e}" - src/server.py:41-41 (registration)The tool is registered via the @mcp.tool decorator (line 41) with ToolAnnotations(readOnlyHint=True). FastMCP handles registration automatically via the decorator pattern.
@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True)) - src/server.py:6-7 (helper)The pyperclip library is imported to handle clipboard operations. pyperclip.copy() is the core utility that performs the actual clipboard write.
import pyperclip from fastmcp import FastMCP