Skip to main content
Glama

Create invoice document from template

well_create_invoice_document_from_template

Render values through an invoice template this workspace built from its own invoice, and store the resulting PDF.

Give the template's document_id and input: the invoice's values, in the same shape the built-in invoice designs take. Call well_list_generative_documents with kind "invoice" to read that shape as a JSON Schema. Values that do not match are refused with the path and reason of the first problems found (at most 50), so fix them and call again.

The template must already be kept by the user. A template still awaiting review, or one that was declined, refuses to render.

Totals are never supplied: the subtotal, the tax rows, each lot's subtotal and the grand total are computed from the lines when the template runs, so a printed total can never disagree with the lines above it.

The PDF is stored as its own document and the tool returns its document_id.

Input Schema

NameRequiredDescriptionDefault
inputYesThe invoice's values, matching the invoice kind's params_json_schema.
document_idYesThe kept template document to render through.
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
errorNo
issuesNoThe first input values that did not match the invoice schema.
successYes
filenameNo
document_idNoThe stored PDF.
refusal_reasonNoThe WellError code when the render is refused.
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.
conversation_id_noteNoPresent only when the server opened a fresh lane, stating that no choice recorded earlier was read.
template_document_idNo
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 / 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."
  2. 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"
      +}
  3. Changed1 schema field changed
    • 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"
      +}
  4. Added

TDQS

A4.3/5.0
Behavior5/5

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

Goes well beyond the annotations: it discloses validation behavior (refusal with the path and reason of the first 50 problems, then retry), lifecycle gating (kept vs awaiting-review vs declined), a domain rule that totals are never supplied and are computed from lines, and the side effect that the PDF is stored as its own document whose document_id is returned.

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-loaded with the core action, then ordering precondition, error behavior, and return value. Mostly every sentence carries information, though the totals paragraph is wordier than needed ('so a printed total can never disagree with the lines above it') for a rule that could be stated in one clause.

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?

For a write tool with six parameters and nested input, the description covers the prerequisite lifecycle, the source of the input schema, validation failure handling, the computed-totals invariant, and the return value. With an output schema and full annotation coverage, nothing an agent needs to invoke it correctly 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 description coverage is already 100%, so the baseline is 3. The description adds real meaning on top: document_id is specifically the kept template document, and input is the invoice values in the same shape the built-in invoice designs take, with a pointer to well_list_generative_documents for the JSON Schema. It says nothing extra about workspace_id, conversation_id, idempotency_key, or workspace_scope.

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?

States a specific verb and resource: rendering values through a workspace-built invoice template and storing the resulting PDF. The mechanism (user-kept template, values shaped like the built-in invoice design) separates it in kind from well_create_invoice_document and well_create_invoice_template, but it never names an alternative outright, so the differentiation is inferential.

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?

Gives clear preconditions for use: the template must already be kept by the user, awaiting-review or declined templates refuse to render, and the input must match the invoice kind's schema. It also routes the agent to well_list_generative_documents to fetch that schema. It lacks explicit when-not/alternative routing versus the other invoice-creation siblings.

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