Attach a file to a session
opencode_file_attachAttach a file to an OpenCode session by path or base64 data, then optionally send it with a prompt and return the response; otherwise get the stored attachment descriptor and path.
Instructions
Upload a file into a session. Provide path (server-side file) or data (base64 bytes). When text is supplied the file is sent immediately as a prompt and the answer is returned; otherwise the attachment descriptor and stored path are returned for a later prompt.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionID": "<sessionID>"
},
"name": "opencode_file_attach"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | Base64-encoded file contents | |
| mime | No | ||
| name | No | ||
| path | No | Absolute or workspace-relative path | |
| text | No | Also send this prompt with the attachment | |
| wait | No | ||
| sessionID | Yes | ||
| description | No |