Get last invoice number
well_get_last_invoice_numberRead the last invoice number the company issued in one connected invoicing or accounting tool (a row of invoice_numbering.number_sources in well_get_accounting_settings), so the workspace's first invoice in Well continues that sequence. Well runs that tool's own read of its newest sales invoices and returns the highest number of the newest invoice's series. It changes nothing.
Returns { success, outcome, decision, last_invoice_number, next_invoice_number }. Follow decision: "apply_preset" (this tool holds no issued invoice): read the next number_sources row; save Well's preset (well_upsert_accounting_settings, next_invoice_number_preset true) only when every row answered apply_preset, and say so in one line with no question. "ask" with outcome "found": show last_invoice_number and ask whether the next invoice takes the number after it; on a yes, save it with next_invoice_number_after set to last_invoice_number exactly as returned. "ask" with any other outcome: Well could not read the tool; save nothing and let the user pick the preset or type the number.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service_id | Yes | The service_id of one invoice_numbering.number_sources row of well_get_accounting_settings. | |
| workspace_id | No | Target workspace. Omit when the token authorizes one workspace. Required when it authorizes several: this read reports one workspace's own figures and will not choose 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. | |
| 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 | ||
| decision | 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. | |
| last_invoice_number | No | ||
| next_invoice_number | No | ||
| 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. |