Skip to main content
Glama

Create invoice document

well_create_invoice_document

Render an existing invoice as a print-ready PDF and attach it as the invoice's source document. The invoice shortcut of well_generate_document: it prints the invoice in its own chosen design, ink and locale. Use well_generate_document instead to choose another design or to print values that are not an invoice in Well.

The letterhead carries the issuing company's own mark when Well has one on file, and otherwise sets the issuer's name as text. Never promise a logo.

Use this tool when the user asks to generate, render, or attach a PDF for an invoice that already exists in the workspace. This does NOT email or send the invoice anywhere — it only creates and attaches the file. A request to email or send an invoice is not a request for its PDF: do not call this tool for it.

REQUIRED: invoice_id (the invoice must already exist)

Refused if the invoice is already linked to a REAL ingested document (an upload, a connector import, or a provider-issued PDF) — that source of truth is never overwritten.

Returns { success: true, invoice_id, document_id, reference_number, file } on success, or { success: false, error } on failure.

file carries the rendered PDF's name and size plus the links to fetch it. Hand the user download_url when they ask for the PDF itself.

  • download_url saves the PDF and signed_url opens it in a browser. Both work with a plain HTTP GET and no auth header, and stop working at expires_at.

  • preview_url is a PNG image of the first page, for showing the document; add page=N for page N, up to page_count. Same token and expiry.

  • sheet_url is the document's HTML sheet, which the card draws with zoom and pan. Same token and expiry.

  • When the user wants to do more with a PDF already generated (attach it to an email, upload it elsewhere, read or analyse it), fetch download_url with a plain HTTP GET.

  • If the links have expired, call this tool again to refresh the same document and its links.

  • app_url opens the document in Well and never expires.

  • The links grant access to the file on their own: share them only with the user.

Input Schema

NameRequiredDescriptionDefault
invoice_idYes
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.
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

NameRequiredDescriptionDefault
fileNo
errorNo
successYes
invoice_idNo
document_idNo
invoice_statusNo
conversation_idNoThe conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation.
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.
reference_numberNo
document_type_codeNo
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. Changed18 schema fields changed
    • removedOutput schema / properties / document_type_code / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / document_type_code / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / file / properties / app_url / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / file / properties / app_url / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / file / properties / download_url / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / file / properties / download_url / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / file / properties / expires_at / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / file / properties / expires_at / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / file / properties / page_count / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / file / properties / page_count / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / properties / file / properties / preview_url / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / file / properties / preview_url / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / file / properties / sheet_url / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / file / properties / sheet_url / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / file / properties / signed_url / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / file / properties / signed_url / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / reference_number / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / reference_number / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  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. Changed4 schema fields changed
    • addedOutput schema / properties / invoice_status / anyOf
      Added value: +[
      +  {
      +    "enum": [
      +      "draft",
      +      "issued",
      +      "paid",
      +      "canceled"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / invoice_status / enum
      Removed value: -[
      -  "draft",
      -  "issued",
      -  "paid",
      -  "canceled"
      -]
    • removedOutput schema / properties / invoice_status / type
      Removed value: -"string"
    • 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"
      +}
  5. Changed6 schema fields changed
    • addedOutput schema / properties / document_type_code
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / file / properties / page_count
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "How many pages the PDF prints."
      +}
    • addedOutput schema / properties / file / properties / preview_url
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "A PNG image of the PDF's first page, for showing the document. Add page=N for page N."
      +}
    • addedOutput schema / properties / file / properties / sheet_url
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "The document's HTML sheet, for a viewer that draws the document itself instead of showing the PDF."
      +}
    • changedOutput schema / properties / file / required
      Previous value: -[
      -  "name",
      -  "size_bytes",
      -  "signed_url",
      -  "download_url",
      -  "app_url",
      -  "expires_at"
      -]New value: +[
      +  "name",
      +  "size_bytes",
      +  "signed_url",
      +  "download_url",
      +  "app_url",
      +  "preview_url",
      +  "sheet_url",
      +  "page_count",
      +  "expires_at"
      +]
    • addedOutput schema / properties / invoice_status
      Added value: +{
      +  "enum": [
      +    "draft",
      +    "issued",
      +    "paid",
      +    "canceled"
      +  ],
      +  "type": "string"
      +}
  6. Changed4 schema fields changed
    • addedInput schema / properties / conversation_id
      Added value: +{
      +  "description": "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.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / conversation_id
      Added value: +{
      +  "description": "The conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / conversation_id_note
      Added value: +{
      +  "description": "Present only when the server opened a fresh lane, stating that no choice recorded earlier was read.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / conversation_id_source
      Added value: +{
      +  "description": "Where the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened.",
      +  "enum": [
      +    "host_meta",
      +    "argument",
      +    "minted"
      +  ],
      +  "type": "string"
      +}
  7. Changed1 schema field changed
    • changedInput schema / properties / workspace_id / description
      Previous value: -"Target workspace. Omit to use the only authorized workspace, or (for read tools) to query all authorized workspaces grouped by workspace. Required for write tools when the token authorizes more than one workspace."New value: +"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."
  8. Changed1 schema field changed
    • addedOutput schema / properties / file
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "app_url": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "download_url": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "expires_at": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "name": {
      +      "type": "string"
      +    },
      +    "signed_url": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "size_bytes": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "name",
      +    "size_bytes",
      +    "signed_url",
      +    "download_url",
      +    "app_url",
      +    "expires_at"
      +  ],
      +  "type": "object"
      +}
  9. Added

TDQS

A4.7/5.0
Behavior5/5

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

Goes well beyond the annotations: it discloses the refusal condition (already linked to a REAL ingested document — upload, connector import, provider PDF — is never overwritten), the letterhead fallback behavior with an explicit "Never promise a logo" instruction, and link expiry/refresh semantics. The destructiveHint=false annotation is consistent with the stated non-overwrite guarantee, so nothing is contradicted.

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

Conciseness3/5

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

Purpose, alternative, and the email exclusion are correctly front-loaded, but the long bulleted inventory of download_url/signed_url/preview_url/sheet_url/app_url largely restates fields the output schema already defines. Only the behavioral fragments (hand the user download_url, re-call to refresh expired links, share only with the user) genuinely earn their space.

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

Completeness5/5

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

Complete for a mutation tool: it covers the precondition, the refusal case, the design/locale inheritance, the alternative tool, and the follow-up actions after a successful render. Nothing an agent needs in order to call this correctly and use the result is missing.

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

Parameters4/5

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

Schema coverage is 80%, so the other four parameters are already self-documented. The description still adds real meaning to invoice_id by stating the precondition that the invoice must already exist — a constraint the schema (bare UUID) does not express.

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?

Opens with a specific verb and resource: "Render an existing invoice as a print-ready PDF and attach it as the invoice's source document." It immediately names the sibling it specializes (well_generate_document) and states exactly how it differs, so an agent can route between the two without opening a schema.

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 an explicit trigger ("when the user asks to generate, render, or attach a PDF for an invoice that already exists") plus a hard exclusion: emailing/sending an invoice is not a request for its PDF, and well_generate_document is the alternative for other designs or non-invoice values. Both when-to-use and when-not-to-use are covered.

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.

Resources