get_clipboard
Retrieve clipboard content from Windows systems to access copied text or data for automation workflows.
Instructions
获取剪贴板内容
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_clipboard"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/clipboard.js:60-69 (handler)Core implementation of the get_clipboard tool: executes PowerShell 'Get-Clipboard' to retrieve and return clipboard content.
async getClipboard() { try { const { stdout } = await execAsync('powershell -Command "Get-Clipboard"', { shell: 'powershell.exe' }); return { success: true, content: stdout.trim() }; } catch (error) { return { success: false, error: error.message }; } } - src/tools/clipboard.js:12-19 (schema)Input schema definition for the get_clipboard tool (no required inputs).
{ name: 'get_clipboard', description: '获取剪贴板内容', inputSchema: { type: 'object', properties: {}, }, }, - src/server.js:43-52 (registration)ClipboardTools instance is registered in the central tools map, enabling dynamic tool discovery and execution routing.
this.tools = { filesystem: new FileSystemTools(), process: new ProcessTools(), mouseKeyboard: new MouseKeyboardTools(), window: new WindowTools(), screen: new ScreenTools(), clipboard: new ClipboardTools(), powershell: new PowerShellTools(), browser: new BrowserTools(), }; - src/tools/clipboard.js:47-58 (helper)Tool dispatcher within ClipboardTools that handles routing get_clipboard calls to the specific handler.
async executeTool(name, args) { switch (name) { case 'get_clipboard': return await this.getClipboard(); case 'set_clipboard': return await this.setClipboard(args.text); case 'clear_clipboard': return await this.clearClipboard(); default: throw new Error(`未知工具: ${name}`); } } - src/server.js:97-102 (helper)Central dispatch logic in server that routes tool calls to the appropriate tool module based on canHandle.
for (const [category, toolModule] of Object.entries(this.tools)) { if (toolModule.canHandle(name)) { result = await toolModule.executeTool(name, args); break; } }