Store a mail attachment as a document
well_create_document_from_mail_attachmentStore one attachment of one message of the caller's own Gmail or Outlook as a document of this workspace, and return its document_id. Use it after well_search_mailbox_for_receipt found the message that fits, when its already_in_well is false, to get a stored document that another tool takes (for example well_link_receipt_to_transaction). Pass the match's provider, mailbox and message_id exactly as returned. Leave filename null: a message with one file attachment stores it; a message with several returns attachment_choice_needed with candidates (file name, size, type): pick the one that fits, or ask the person, then call again with its filename and size.
The write stays inside Well: it sends nothing, changes nothing in the mailbox and reads only the caller's own mailboxes. The document then goes through the same reading as an uploaded file.
Returns outcome: "created" (a new document), "already_stored" (the same file was already a document; its id is returned), "attachment_choice_needed", "attachment_not_found" (no file attachment, or none with that name and size; candidates lists what the message holds), "message_not_found", "mailbox_not_found" (the caller has no live mailbox of that provider and address here), "needs_reconnect", "too_large", "type_refused" or "unavailable". Only "created" and "already_stored" carry a document_id; never say a file is stored on any other outcome.
When the token authorizes one workspace, call this directly — no workspace call is needed first. When it authorizes several, this read will not guess which one you mean: pass workspace_id on the call.
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": {
"provider": "<provider>",
"message_id": "<message_id>"
},
"name": "well_create_document_from_mail_attachment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | The attachment's size in bytes, from `candidates`. It tells apart two attachments that share a name. | |
| mailbox | No | The match's `mailbox` address, as returned. Pass null only when it returned null. | |
| filename | No | The attachment's file name. Leave null on the first call; pass one of the returned `candidates` when the answer is attachment_choice_needed. | |
| provider | Yes | The match's `provider`, as well_search_mailbox_for_receipt returned it. | |
| message_id | Yes | The match's `message_id`, as returned. | |
| workspace_id | No | Target workspace. Omit when the token authorizes one workspace. Required when it authorizes several — a write lands in exactly one workspace and this call would not say which. | |
| conversation_id | No | The conversation id returned by the previous Well result, in its meta under well/conversation_id, in its structuredContent, or in its JSON text block. Pass it back on every call in the same conversation, including a call a card makes, so the chosen workspace and the earlier answers still apply. It decides the conversation on its own: nothing the host states about the session replaces it. Omit it only on the first call of a conversation. | |
| idempotency_key | No | Optional client-supplied key. A retried write with the same key returns the original result instead of re-applying the operation. | |
| workspace_scope | No | Restrict this call to the family: the token's primary workspace plus the company workspaces under it that you are a member of. Unrelated authorized workspaces drop out of the read; row reads merge across the family, while a per-workspace figure still reports exactly one workspace. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | ||
| outcome | No | ||
| success | Yes | ||
| attachment | No | ||
| candidates | No | ||
| document_id | No | ||
| conversation_id | No | The conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation. | |
| newly_connected | No | Tools that connected to this workspace since the last result and that no session was told about yet, oldest first. Present only when at least one tool is new. The connected-line rule says when to tell an entry; when it does, one line per entry, in the person's language: "<name> is connected.". Never fold several entries into one sentence. Each entry comes back once, on one result only: never repeat its line later. | |
| resolved_workspace | No | The workspace that answered, when the caller named none and the token authorizes several. | |
| conversation_id_note | No | Present only when the server opened a fresh lane, stating that no choice recorded earlier was read. | |
| conversation_id_source | No | Where the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened. |