Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • 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 ""
  • Registers the read_clipboard tool on the FastMCP instance using the @mcp.tool() decorator.
    @mcp.tool()
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by explaining key behaviors: it returns text content, handles empty/non-text cases by returning an empty string, and describes the return value. It doesn't mention potential permissions or system-specific limitations, leaving some gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise and front-loaded: the first sentence states the core purpose, followed by two sentences explaining return behavior. Every sentence adds essential value with zero waste or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no annotations, but with an output schema), the description is complete: it explains what the tool does, when it's used, and behavioral details like empty/non-text handling. The output schema will cover return structure, so no need to elaborate further.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema already fully documents this. The description appropriately doesn't add parameter details, maintaining focus on functionality. A baseline of 4 is given since no parameters exist to explain.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Read') and resource ('current text content from the system clipboard'), distinguishing it from its sibling 'write_clipboard' which performs the opposite operation. The purpose is unambiguous and well-defined.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool (to retrieve clipboard text) and implicitly contrasts with 'write_clipboard' for setting clipboard content. However, it doesn't explicitly name the alternative or provide exclusion criteria, which prevents a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dahlia/clipboard-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server