Skip to main content
Glama
odoo19-mcp-server

odoo19-mcp-server

by twtrubiks

Add Attachment

add_attachment

Upload 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).

Input Schema

NameRequiredDescriptionDefault
res_idNoRecord ID to attach to. Required if res_model is provided.
file_nameNoFilename 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_pathNoPath 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_modelNoModel to attach to (e.g., 'account.move'). None for standalone attachment.
base64_dataNoFile content as a base64-encoded string. Mutually exclusive with file_path.
descriptionNoOptional description for the attachment.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.2.0

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses a genuine behavioral constraint: the path must resolve inside UPLOAD_DIR (default /shared/uploads) and paths outside are refused, plus the mutual exclusion of file_path and base64_data. However, it omits Odoo-side permission/auth requirements, size limits, and whether this creates a new ir.attachment record or overwrites existing ones, which matters for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the purpose in one line, then uses a tight two-bullet structure for the modes; no filler sentences. There is minor redundancy with the schema's UPLOAD_DIR constraint, but repeating a security-critical constraint in the description is defensible.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Both input modes, the cross-tool routing to prepare_upload, and the directory jail are covered, and an output schema exists so return values need no explanation. The remaining gap is behavioral, not structural: auth requirements and write-side effects go unmentioned for a mutation tool with no annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents every parameter, including the mutual exclusivity of file_path and base64_data and the res_id/res_model dependency. The description restates the mode semantics but adds no syntax or value format beyond the schema, so the baseline of 3 is correct.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Upload a file attachment to Odoo via ir.attachment') and immediately enumerates the two supported input modes, so the agent knows exactly what the tool does. The distinction from sibling create_record is implicit in the attachment-only scope, and the prepare_upload reference further locates it in the toolset.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit mode-selection rules: use file_path when the file lives on the MCP server, base64_data when the file is not on disk (with a concrete example, 'image uploaded via Discord'). It names the alternative tool (prepare_upload) and the exact condition that selects it (remote server, client-side file), leaving nothing to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.