Package com.tnsai.tools.goose
Class ClipboardTools
java.lang.Object
com.tnsai.tools.goose.ClipboardTools
Function-shape OS clipboard tools — text read/write via AWT. Replaces the
legacy
ClipboardTool's text branch. Image clipboard ops are
intentionally deferred — they add complexity for marginal value, and a
caller can use SystemTools.http_request or
DocumentTools.image_convert for image-data round trips.
| Method | Backend | Idempotent |
|---|---|---|
clipboardReadText() | AWT Clipboard | true (read-only) |
clipboardWriteText(java.lang.String) | AWT StringSelection | true (set semantics — same content twice yields same state) |
Pure-AWT; no auth, no network. Fails fast in headless JVMs with a helpful message.
- Since:
- 0.5.7 (Phase 2 batch 32 — built-in tool migration to function shape, see #188)
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ClipboardTools
public ClipboardTools()
-
-
Method Details
-
clipboardReadText
@Tool(name="clipboard_read_text", description="Read the OS clipboard\'s current text content. Returns the empty string when the clipboard holds no text-like data. Throws IOException in headless JVMs. Read-only.", keywords={"clipboard","read","paste","text"}, idempotent=true) public String clipboardReadText() throws IOException- Throws:
IOException
-
clipboardWriteText
@Tool(name="clipboard_write_text", description="Write {text} to the OS clipboard, replacing any previous content. Caps text at 1 MB. Throws IOException in headless JVMs. Set semantics \u2014 writing the same content twice leaves the clipboard in the same state.", keywords={"clipboard","write","copy","set","text"}, idempotent=true) public void clipboardWriteText(@ToolParam(description="Text to copy to the clipboard (max 1 MB)") String text) throws IOException - Throws:
IOException
-