clipboard-mcp
Version:
A Model Context Protocol (MCP) server that provides a tool for taking screenshots of websites.
24 lines (23 loc) • 698 B
JavaScript
import { z } from "zod";
import clipboardy from "clipboardy";
export const clipboardTool = {
title: "Copy to Clipboard",
description: "Copies the provided text to the user's clipboard.",
inputSchema: {
text: z.string().describe("The text to copy to the clipboard."),
},
};
export async function clipboardHandler({ text }) {
try {
await clipboardy.write(text);
return {
content: [{ type: "text", text: "Text successfully copied to clipboard." }],
};
}
catch (error) {
return {
content: [{ type: "text", text: `Failed to copy to clipboard: ${error.message}` }],
isError: true,
};
}
}