Skip to main content
Glama

Attach Document

attach_document
Destructive

Attache un document justificatif (facture, reçu, devis) à une charge, un mobilier, un poste de travaux, une recette ou un bail. Trois modes d'entrée mutuellement exclusifs : file_base64 (contenu encodé), file_path (chemin absolu sur le serveur, nécessite MCP_FILE_PATH_PREFIX), file_url (URL http/https téléchargée par le serveur). Le chemin de stockage est : documents/{user_id}/{type}/{filename}.

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": {
      "type": "<type>",
      "record_id": "<record_id>",
      "label": "<label>"
    },
    "name": "attach_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeYesType d'enregistrement cible : expense, furniture, work, income, lease
labelYesLibellé du document (ex: Facture plombier, Reçu IKEA)
amountNoMontant indiqué sur le document en euros (optionnel)
file_urlNoURL http/https du fichier à télécharger par le serveur. Mutuellement exclusif avec file_base64 et file_path.
filenameNoNom du fichier avec extension (ex: facture.pdf). Déduit automatiquement depuis file_path ou file_url si absent.
file_pathNoChemin absolu du fichier sur le serveur (nécessite MCP_FILE_PATH_PREFIX configuré). Mutuellement exclusif avec file_base64 et file_url.
record_idYesIdentifiant de la charge, du mobilier, du poste de travaux, de la recette ou du bail
file_base64NoContenu du fichier encodé en base64 (PDF, JPG, PNG, WebP, HEIC — max 10 Mo). Mutuellement exclusif avec file_path et file_url.
document_dateNoDate du document au format Y-m-d (optionnel)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / record_id / description
      Previous value: -"Identifiant de la charge, du mobilier ou du poste de travaux"New value: +"Identifiant de la charge, du mobilier, du poste de travaux, de la recette ou du bail"
    • changedInput schema / properties / type / description
      Previous value: -"Type d'enregistrement cible : expense, furniture, work"New value: +"Type d'enregistrement cible : expense, furniture, work, income, lease"
  2. Changed9 schema fields changed
    • addedInput schema / properties / amount / description
      Added value: +"Montant indiqué sur le document en euros (optionnel)"
    • addedInput schema / properties / document_date / description
      Added value: +"Date du document au format Y-m-d (optionnel)"
    • addedInput schema / properties / file_base64 / description
      Added value: +"Contenu du fichier encodé en base64 (PDF, JPG, PNG, WebP, HEIC — max 10 Mo). Mutuellement exclusif avec file_path et file_url."
    • addedInput schema / properties / file_path / description
      Added value: +"Chemin absolu du fichier sur le serveur (nécessite MCP_FILE_PATH_PREFIX configuré). Mutuellement exclusif avec file_base64 et file_url."
    • addedInput schema / properties / file_url / description
      Added value: +"URL http/https du fichier à télécharger par le serveur. Mutuellement exclusif avec file_base64 et file_path."
    • addedInput schema / properties / filename / description
      Added value: +"Nom du fichier avec extension (ex: facture.pdf). Déduit automatiquement depuis file_path ou file_url si absent."
    • addedInput schema / properties / label / description
      Added value: +"Libellé du document (ex: Facture plombier, Reçu IKEA)"
    • addedInput schema / properties / record_id / description
      Added value: +"Identifiant de la charge, du mobilier ou du poste de travaux"
    • addedInput schema / properties / type / description
      Added value: +"Type d'enregistrement cible : expense, furniture, work"
  3. First observed

TDQS

A3.6/5.0
Behavior3/5

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

Annotations declare only destructiveHint=true, and the description does not explain what that destruction means — whether attaching a second file replaces an existing one, whether the target record is modified, or what is returned. It does add genuinely useful operational context (server-side URL download, the documents/{user_id}/{type}/{filename} storage layout, the env-var prerequisite for file_path), which is value beyond the annotation.

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?

Three dense sentences with the core action first, then the input-mode rules, then the storage location — no filler or marketing language. Slight redundancy with the schema's own parameter descriptions keeps it from a 5.

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?

For a 9-parameter upload tool with no output schema, the definition covers the critical decision points: which record types are valid, how to supply the file, and where it lands. The remaining gap is the meaning of destructiveHint and what the tool returns (document id? URL?), which an agent would want before calling a mutation.

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 all nine parameters, including the mutual exclusivity of the three file inputs and the MCP_FILE_PATH_PREFIX requirement. The description largely restates that, adding only the storage-path convention showing how type and filename feed into the destination. Baseline 3 is appropriate.

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

Purpose4/5

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

The description opens with a specific verb and resource ('Attache un document justificatif') and enumerates the five record types it can attach to (charge, mobilier, poste de travaux, recette, bail), so the agent knows exactly what the tool does. It never names a sibling (analyze_document, delete_document, export_documents) to disambiguate, so it falls short of the top mark.

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

Usage Guidelines4/5

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

It gives a clear operational rule: the three input modes are 'mutuellement exclusifs', and file_path requires MCP_FILE_PATH_PREFIX to be configured. That is real when/how guidance for choosing among parameters, but there is no guidance on when to use this tool versus analyze_document or export_documents, nor any stated prerequisites about the target record existing.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.