# copy_text_to_clipboard

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/clipboard/copy_text_to_clipboard)

Copy text to the system clipboard.

## Signature

```python
copy_text_to_clipboard(
    app: App,
    text: str,
) -> tuple[bool, str | None]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `app` | `App` | Yes | The active Textual app, used for the app clipboard backend. |
| `text` | `str` | Yes | Text to copy. |

## Returns

`tuple[bool, str | None]`

Tuple of `(success, error_message)`.

`success` is `True` when one backend completed without raising.
`error_message` is `None` on success and the last backend's error
string when every backend failed, suitable for surfacing to the
user so they can self-diagnose missing clipboard support.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/d1c6946218b4f0f86ab7b02b6bb6af1e4b75cede/libs/code/deepagents_code/clipboard.py#L50)