Build the profit and loss and balance sheet from the ledger
well_get_pennylane_statementsBuild a profit and loss (compte de résultat) and a balance sheet (bilan) from the trial balance of the workspace's connected Pennylane. Pennylane shares no ready profit and loss or balance sheet, only its trial balance (getTrialBalance). Well reads every page of it and computes the totals itself, account class by account class of the French chart of accounts (PCG). Every amount is a decimal string in euros, such as "5000.00". State each amount exactly as returned and name the source: "computed by Well from the Pennylane trial balance". Never add, round or recompute an amount, and never call getTrialBalance yourself to rebuild one.
Use it when the user asks for a profit and loss, an income statement, a compte de résultat, a balance sheet or a bilan, and the workspace's accounting tool is Pennylane. Do not use it for QuickBooks or Xero, whose own reports well_invoke_connector_tool reads.
Inputs. workspace_connector_id is the Pennylane accounting row's id from well_get_connector_coverage. statements is income_statement, balance_sheet or both. to is the last day, YYYY-MM-DD, never after today: the profit and loss ends on it and the balance sheet is dated on it. from is the first day of the profit and loss, required for income_statement and both. The period must sit inside one Pennylane fiscal year.
Output. income_statement gives revenue (class 7) and expenses (class 6), each with its total and its two-digit PCG groups, and net_result (revenue minus expenses, negative is a loss). balance_sheet gives assets and equity_and_liabilities, each with its total and sections, and result_for_the_year (from the fiscal year start to to, inside equity). The two totals are equal. source names the connection, the tool, the chart and each trial balance read with its dates and row count. opening_balances says how the balance sheet was shown to include the opening balances: carried from the closed previous year, or an opening entry on the first day of the fiscal year. fiscal_year.status is the year's status in Pennylane: open or reopen means entries can still be booked in it, so the figures can still change; say so once.
Refusals carry no statement. opening_balances_unverified: Well cannot show that the balance sheet includes the opening balances (à-nouveaux) of the fiscal year, usually because the previous year is not closed in Pennylane yet or its opening entry is not imported yet; the profit and loss alone still works. trial_balance_semantics_unproven: Well cannot show that Pennylane's trial balance holds only the movements of the dates asked for. Before every profit and loss and every balance sheet, Well splits the trial balance at one day (the day before from for a profit and loss that starts after the fiscal year start, otherwise the day before to) and checks that the two parts add up to the whole on every class 6 and 7 account. The check failed, or a statement dated on the first day of the fiscal year left no day to split at. Well then builds neither statement, and the refusal carries trial_balance: Pennylane's trial balance for the dates asked for, with its full row_count and at most its first twenty rows, each exactly as Pennylane returned it. closing_entries_suspected: either every profit and loss account nets to zero on to although the earlier days of the year moved some, or the result of the year (chapter 12) moves on to (checked on the last day of the span, and on the last day of the fiscal year for a later period), which means Pennylane probably booked the closing entries of the fiscal year on that day; Well builds no statement and the refusal carries trial_balance the same way. Show those rows as Pennylane's trial balance, never as a profit and loss or a balance sheet, and add nothing up; when row_count is above the rows returned, say the full trial balance is in Pennylane. connection_not_found: no Pennylane connection matches workspace_connector_id in this workspace. unsupported_source: the connection is not a Pennylane input connection served over MCP (pennylane or pennylane-token). unsupported_currency: the workspace's base currency is not EUR. unsupported_framework: the Pennylane company does not use a French chart of accounts. framework_not_reviewed: the company uses a French sector chart (agriculture, non-profit or notary) that Well's statements do not cover yet. scope_missing: the connection was not granted the trial balance; it needs a reconnect. tool_not_read_only: Well's record of the connection does not mark a Pennylane read as read-only, so Well calls nothing. connection_not_readable: the connection is not enabled, or its grant expired during the read (connection_status says which state). When the connection is in the state need_reconnect or error, a scope_missing or connection_not_readable refusal carries reconnect_url, the link that reconnects this Pennylane connection: give it to the user as a clickable link, exactly as returned, and never build a connector link yourself. Without reconnect_url, give no link. read_incomplete: the trial balance did not come back whole. invalid_trial_balance: the trial balance came back whole but does not balance or holds a row Well cannot read (defect says which). fiscal_year_not_found and invalid_period: the dates do not fit one Pennylane fiscal year. failed: the read failed and nothing is known. Say each refusal in one plain line and state no figure, except the trial_balance rows of trial_balance_semantics_unproven and closing_entries_suspected, shown as returned.
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
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Last day, YYYY-MM-DD, never after today: the profit and loss ends on it and the balance sheet is dated on it. | |
| from | No | First day of the profit and loss, YYYY-MM-DD. Required for `income_statement` and `both`. | |
| statements | Yes | `income_statement`, `balance_sheet`, or `both`. | |
| 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. | |
| workspace_connector_id | Yes | The Pennylane accounting row's workspace_connector_id, from well_get_connector_coverage. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | ||
| defect | No | Set on `invalid_trial_balance`. | |
| source | No | ||
| status | Yes | Where the call ended. Only `ok` carries figures. | |
| success | Yes | True only when `status` is `ok`. | |
| currency | No | ||
| fiscal_year | No | ||
| balance_sheet | No | ||
| reconnect_url | No | Set on `scope_missing` and `connection_not_readable` when the connection is in the state `need_reconnect` or `error`: the link that reconnects this Pennylane connection. Give it as returned. | |
| trial_balance | No | Set on `trial_balance_semantics_unproven` and `closing_entries_suspected`: Pennylane's trial balance for the dates asked for. `row_count` is the full count and `rows` holds at most the first twenty, each exactly as Pennylane returned it. Show it as Pennylane's trial balance, not as a statement, and add nothing up. | |
| 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. | |
| income_statement | No | ||
| opening_balances | No | ||
| connection_status | No | Set on `connection_not_readable`: the connection's state. | |
| resolved_workspace | No | The workspace that answered, when the caller named none and the token authorizes several. | |
| 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. |