Add Attachment
add_attachmentUpload files to Odoo as ir.attachment records from a server-side path or base64 data, and link them to any model record by res_model and res_id.
Instructions
Upload a file attachment to Odoo via ir.attachment.
Supports two input modes:
file_path: Read a local file from the MCP server's filesystem. The path must resolve to a location inside UPLOAD_DIR (default /shared/uploads); paths outside it are refused. If the file lives on the CLIENT machine and this server is remote, call prepare_upload first and POST the file to /upload to obtain a server-side file_path.
base64_data + file_name: Pass file content directly as base64 string. Use this when the file is not on disk (e.g., image uploaded via Discord).
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": "add_attachment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| res_id | No | Record ID to attach to. Required if res_model is provided. | |
| file_name | No | Filename for the attachment (e.g., 'invoice.png'). Required with base64_data; optional with file_path (defaults to the file's own name — handy to restore a real name when file_path points at a server-generated /upload name). | |
| file_path | No | Path to a local file the MCP server can read. Must resolve to a location inside UPLOAD_DIR (default /shared/uploads); paths outside it are refused. Mutually exclusive with base64_data. | |
| res_model | No | Model to attach to (e.g., 'account.move'). None for standalone attachment. | |
| base64_data | No | File content as a base64-encoded string. Mutually exclusive with file_path. | |
| description | No | Optional description for the attachment. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |