Skip to main content
Glama

Get last invoice number

well_get_last_invoice_number
Read-only

Read 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

NameRequiredDescriptionDefault
service_idYesThe service_id of one invoice_numbering.number_sources row of well_get_accounting_settings.
workspace_idNoTarget 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_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.
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
outcomeNo
successYes
decisionNo
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.
resolved_workspaceNoThe workspace that answered, when the caller named none and the token authorizes several.
last_invoice_numberNo
next_invoice_numberNo
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. Changed6 schema fields changed
    • removedOutput schema / properties / last_invoice_number / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / last_invoice_number / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / next_invoice_number / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / next_invoice_number / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / resolved_workspace / properties / name / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / resolved_workspace / properties / name / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  2. Changed1 schema field changed
    • addedOutput schema / properties / decision
      Added value: +{
      +  "enum": [
      +    "apply_preset",
      +    "read_last_number",
      +    "ask"
      +  ],
      +  "type": "string"
      +}
  3. Added

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the readOnly/openWorld annotations, it explains that the tool performs an external read of the connected tool's newest sales invoices and returns the highest number in the newest invoice's series. It also discloses that it changes nothing, lists the returned fields, and defines the decision outcomes that drive follow-up behavior.

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?

The description is dense but front-loads the core purpose before moving into behavior and decision handling. Every sentence appears to serve a purpose, though the long single-paragraph decision logic could be formatted more scannably.

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?

Given the tool's complexity, the existing output schema, and the annotations, the description covers purpose, external-read behavior, return fields, and all decision branches. An agent has enough information to invoke it and act on its result without further clarification.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all four parameters. The description adds useful context that service_id corresponds to one invoice_numbering.number_sources row, but it does not meaningfully expand the semantics of workspace_id, conversation_id, or workspace_scope.

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?

The description states a specific verb and resource: read the last invoice number issued by one connected tool, and explains its downstream purpose for Well's own invoice sequence. It is clearly distinguishable from siblings such as well_get_accounting_settings and well_upsert_accounting_settings.

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?

It provides explicit branch-by-branch guidance for apply_preset, ask/found, and ask/other outcomes, including when to save a preset and when to save nothing. It also names the related siblings and tells the agent exactly how to proceed in each case.

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