Skip to main content
Glama

clipboard_read

Read macOS clipboard contents as plain text to access copied data for automation tasks.

Instructions

Read the current contents of the macOS clipboard as plain text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the `clipboard_read` tool logic by calling the `clipboardRead` helper.
    async function handleClipboardRead(): Promise<CallToolResult> {
      const text = await clipboardRead();
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify({ text }),
          },
        ],
      };
    }
  • The implementation of `clipboardRead` helper which executes `pbpaste`.
    export async function clipboardRead(): Promise<string> {
      const { stdout } = await execFileAsync("pbpaste", [], {
        timeout: CLIPBOARD_TIMEOUT_MS,
      });
      return stdout;
    }
  • Definition of the `clipboard_read` tool.
    {
      name: "clipboard_read",
      description:
        "Read the current contents of the macOS clipboard as plain text.",
      inputSchema: zodToToolInputSchema(ClipboardReadInputSchema),
      annotations: {
        readOnlyHint: true,
        destructiveHint: false,
      },
    },
  • Input schema for `clipboard_read`.
    const ClipboardReadInputSchema = z.object({});

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/antbotlab/mac-use-mcp'

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