Skip to main content
Glama

Send an email draft

well_send_email_draft
Idempotent

Save the final text of an email draft into the user's own Gmail drafts, or hand it to the user's own email app. Well sends nothing itself. The card that well_draft_email shows calls this when the user presses Send.

Do not call it yourself to send on the user's behalf. Draw the card with well_draft_email and let the user press Send.

REQUIRED: to (at least one address), subject and body_lines (the paragraphs), all exactly as the user last saw them. attachment_ids are document_ids of this workspace. Pass the card's draft_id unchanged: it keys the durable write, so a second press of the same card replays the first result and never creates a second draft.

Returns status: "draft_created" (with mailbox_address and gmail_drafts_url) when a Gmail draft now waits in the member's mailbox, "draft_queued" when the write is still owed, or "mailto" with a mailto_url — and a fallback_reason when the Gmail path declined. Every status carries mailto_url: on draft_queued the card keeps it as the way out, and a call after the owed write gave up answers mailto with the reason, so the member always keeps a way to send. sent is false on every one of them: the member sends the draft, never Well. The attached documents travel as the download links the body already carries, which do not expire while the document exists. Well sent nothing, so never tell the user the email was sent. A failure carries an error_reason; nothing was sent.

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ccNo
toYes
bccNo
subjectYes
draft_idNoThe `draft_id` the card showed. With it, one Gmail draft is created in the member's connected mailbox; without it (an older card) the draft opens as a `mailto:` link.
body_linesYesThe message's paragraphs, in order.
workspace_idNoTarget 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.
attachment_idsNo`document_id`s of this workspace to attach.
transaction_idNoThe `transaction_id` the card showed for a receipt request. The card echoes it unchanged.
conversation_idNoThe 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_keyNoOptional client-supplied key. A retried write with the same key returns the original result instead of re-applying the operation.
workspace_scopeNoRestrict 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

TableJSON Schema
NameRequiredDescriptionDefault
sentNo
errorNo
statusNo
successYes
mailto_urlNo
error_reasonNo
reconnect_urlNo
conversation_idNoThe conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation.
fallback_reasonNo
mailbox_addressNo
newly_connectedNoTools 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.
gmail_drafts_urlNo
resolved_workspaceNoThe workspace that answered, when the caller named none and the token authorizes several.
connected_mailboxesNo
conversation_id_noteNoPresent only when the server opened a fresh lane, stating that no choice recorded earlier was read.
conversation_id_sourceNoWhere the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / error_reason / enum
      Previous value: -[
      -  "no_workspace",
      -  "invalid_draft",
      -  "draft_failed",
      -  "attachment_not_found",
      -  "attachment_link_unavailable",
      -  "attachment_not_pdf",
      -  "invoice_pdf_missing",
      -  "attachment_required",
      -  "invoice_not_issued",
      -  "invoice_canceled"
      -]New value: +[
      +  "no_workspace",
      +  "invalid_draft",
      +  "draft_failed",
      +  "attachment_not_found",
      +  "attachment_link_unavailable",
      +  "attachment_not_pdf",
      +  "invoice_pdf_missing",
      +  "attachment_required",
      +  "invoice_not_issued",
      +  "invoice_canceled",
      +  "task_not_anomaly",
      +  "task_closed"
      +]
  2. Changed1 schema field changed
    • changedOutput schema / properties / newly_connected / description
      Previous value: -"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. Start the reply with 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."New value: +"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."
  3. Changed1 schema field changed
    • addedInput schema / properties / workspace_scope
      Added value: +{
      +  "description": "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.",
      +  "enum": [
      +    "family"
      +  ],
      +  "type": "string"
      +}
  4. Changed8 schema fields changed
    • addedInput schema / properties / draft_id
      Added value: +{
      +  "description": "The `draft_id` the card showed. With it, one Gmail draft is created in the member's connected mailbox; without it (an older card) the draft opens as a `mailto:` link.",
      +  "format": "uuid",
      +  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      +  "type": "string"
      +}
    • addedInput schema / properties / transaction_id
      Added value: +{
      +  "description": "The `transaction_id` the card showed for a receipt request. The card echoes it unchanged.",
      +  "format": "uuid",
      +  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      +  "type": "string"
      +}
    • addedOutput schema / properties / fallback_reason
      Added value: +{
      +  "enum": [
      +    "scope_missing",
      +    "scope_unverifiable",
      +    "mailbox_ambiguous",
      +    "no_mailbox",
      +    "not_mailbox_owner",
      +    "kill_switch",
      +    "daily_cap_reached",
      +    "draft_failed",
      +    "auth_revoked"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / gmail_drafts_url
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / mailbox_address
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / newly_connected
      Added value: +{
      +  "description": "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. Start the reply with 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.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "name": {
      +        "type": "string"
      +      },
      +      "service_id": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "service_id"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / reconnect_url
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • changedOutput schema / properties / status / enum
      Previous value: -[
      -  "mailto"
      -]New value: +[
      +  "mailto",
      +  "draft_created",
      +  "draft_queued"
      +]
  5. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources