Skip to main content
Glama

Sum a week's missing invoices

well_sum_missing_invoices
Read-only

The missing supplier invoices of one ISO week that has ended, as one total: how many suppliers still miss an invoice, and the spend they cover, in the currency of the lines and converted to the workspace base currency. It returns no rows.

week is an ISO week, YYYY-Www (Monday to Sunday), for example 2026-W40. A week has ended when its Sunday has ended in the workspace time zone. Omit it to read the last week that has ended. A refusal carries error_code: week_invalid for a week its year does not have (a week 53 in a 52-week year), week_not_ended for a week that has not ended yet, no_workspace when no workspace is in context, read_failed when the read of the week failed.

supplier_count counts the suppliers that still miss an invoice, with the gaps and the row rule of the missing-invoices card. total is the spend those suppliers cover, converted to currency (the workspace base currency). It is null when a line has no exchange rate for its date: a partial sum would read as the whole figure. It covers the named suppliers' groups only, so it is not the conversion of a net below, which also holds the groups with no named supplier.

totals_by_currency is the money of the week still missing an invoice, ONE set per currency in the lines' own currency (the currency the bank lines are in), in major units: gross, the copies and own_company movements it holds, and net, the figure to quote. Never add two sets, and never convert one. It is null when the figures could not be read. totals_unreadable_count counts the lines with no readable amount, which sit in no figure.

bank_connected is true when the workspace has a bank feed connected: synced, syncing, or in error. It is false when no bank feed is connected, or every one is disabled or not set up. Only a live bank feed counts: a workspace with imported bank statements only reads false too. Then Well sees no bank spend for the week, so its figures cannot say that nothing is missing: the week could not be checked.

pending_count counts the transactions of those suppliers whose candidate invoice already waits for a confirmation. They are in supplier_count and total, as on the card. unattributed_group_count counts the groups of spend with no named supplier. They are not in supplier_count or total, and they are in totals_by_currency. candidates_truncated: true means the scan filled its page, so supplier_count, total and pending_count are floors; totals_by_currency is read apart and still covers every line.

This tool reads the user's data and changes none of it.

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
weekNoISO week that has ended, YYYY-Www (Monday to Sunday). Omit it for the last ended week.
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

TableJSON Schema
NameRequiredDescriptionDefault
toNoSunday of the week, YYYY-MM-DD, inclusive.
fromNoMonday of the week, YYYY-MM-DD.
weekNo
errorNo
totalNoThe named suppliers' groups only, in the base currency. Null when a line has no exchange rate.
successYes
currencyNoThe workspace base currency (ISO 4217) `total` is converted to. Write `total` with its symbol or code, never the currency of the person's language.
error_codeNo
workspace_idNo
pending_countNo
bank_connectedNoTrue when a bank feed is connected (synced, syncing or in error). False means the week could not be checked.
supplier_countNo
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.
totals_by_currencyNoThe week's money still missing an invoice, one set per currency in the lines' own currency. Null when unreadable.
candidates_truncatedNo
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.
totals_unreadable_countNoLines with no readable amount, in no figure of `totals_by_currency`. Null with it.
unattributed_group_countNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedOutput schema / properties / currency / description
      Added value: +"The workspace base currency (ISO 4217) `total` is converted to. Write `total` with its symbol or code, never the currency of the person's language."
    • 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."
    • changedOutput schema / properties / total / description
      Previous value: -"Null when a line has no exchange rate."New value: +"The named suppliers' groups only, in the base currency. Null when a line has no exchange rate."
    • addedOutput schema / properties / totals_by_currency
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "copies": {
      +            "description": "The part of `gross` that repeats a payment already counted through another connection of the same account.",
      +            "type": "number"
      +          },
      +          "currency": {
      +            "anyOf": [
      +              {
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "The one currency every figure of this set is in. Null for lines that carry no currency."
      +          },
      +          "gross": {
      +            "description": "Every line in this currency, copies and own-account movements included.",
      +            "type": "number"
      +          },
      +          "net": {
      +            "description": "`gross` minus `copies` minus `own_company`. This is the figure to quote.",
      +            "type": "number"
      +          },
      +          "own_company": {
      +            "description": "The part of `gross` that moved between the workspace's own accounts, so it is not spend.",
      +            "type": "number"
      +          }
      +        },
      +        "required": [
      +          "currency",
      +          "gross",
      +          "copies",
      +          "own_company",
      +          "net"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "The week's money still missing an invoice, one set per currency in the lines' own currency. Null when unreadable."
      +}
    • addedOutput schema / properties / totals_unreadable_count
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "Lines with no readable amount, in no figure of `totals_by_currency`. Null with it."
      +}
  2. Changed1 schema field changed
    • addedOutput schema / properties / bank_connected
      Added value: +{
      +  "description": "True when a bank feed is connected (synced, syncing or in error). False means the week could not be checked.",
      +  "type": "boolean"
      +}
  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. 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"
      +}
  5. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources