When developing agent workflows, content generated by an Agent often requires users to manually copy and paste it. dsh-clipboard solves this problem by allowing the Agent to write results directly to the system clipboard, so users can paste them to use without selecting anything first.
Plugin Overview¶
This is a DSH plugin maintained by ZhijiangTang. It registers a tool named clipboard_write, with core features of zero dependencies, pure ESM JavaScript, and no build step required.
Core Features¶
- Cross-platform support: Supports macOS, Windows, and Linux systems.
- Standardized responses: Execution results always return standardized JSON, including the
ok(boolean),bytes(number of bytes written),tool(name of the system tool used), anderror(present only on failure) fields. Any failure does not throw an exception. - Automatic self-check: When the plugin is mounted, it automatically writes a self-check text once, with the log prefix
[dsh-clipboard].
Installation and Enablement¶
Install it using the official DSH command:
dsh plugin --profile <profile-name> add dsh-clipboard
Typical Usage¶
After the Agent generates a command, SQL statement, JSON object, or code snippet, it calls clipboard_write. Users do not need to manually select the content; they can paste it to use directly.
Response example:
{ "ok": true, "bytes": 42, "tool": "pbcopy" }
{ "ok": false, "bytes": 42, "tool": null, "error": "no clipboard tool available (install xclip or xsel): ..." }
Use Cases and Notes¶
- Use cases:
- Have the Agent put generated commands, SQL statements, JSON objects, or code snippets directly into the clipboard.
- Copy temporary tokens, URLs, or file paths.
- Use it as a “handoff output” step in multi-step workflows.
- Notes:
- Linux environment requirements: Requires an available X11 or Wayland session (
DISPLAYorWAYLAND_DISPLAYenvironment variables). Writing to the clipboard will fail in pure SSH sessions or CI containers. - System dependencies: Depends on the system-bundled or installed
pbcopy(macOS),clip(Windows),xclip, orxsel(Linux).
- Linux environment requirements: Requires an available X11 or Wayland session (
Summary¶
This plugin reduces the interaction cost between agents and external systems through minimal dependencies and standardized data responses. It is recommended to review the source code and license before installation. The source code and documentation can be viewed on GitHub.