Switch workspace
well_switch_workspaceWrite this connection's session context — the one place a conversation's standing choices live. This is the tool the widget cards call when the user CLICKS them: the workspace pin and queue, the selected months, the selected counterparties, and the step acknowledgements are all recorded here, and every later tool call defaults to them.
Pass any of:
workspace_ids (ordered list): the workspaces to work in. The FIRST entry becomes the pin and the rest the workspace_queue to work through next. Every id must be one this connection is already authorized for — call well_list_workspaces to see them. This grants no new access; it only chooses among the authorized workspaces.
periods: the months the user VALIDATED on the period card ({ calendar_year, calendar_month } each). Period-scoped reads (well_list_missing_invoices, well_preview_invoice_fetch) default to them when called without a period. Send it only for the user's month selection — never to bound a counterparty pick, which would overwrite that selection.
counterparties: the counterparties (vendors) the user selected, each { company_id, matched_connector_service_id }. Copy both ids off the row you listed them from; pass no display name. The selection belongs to the workspace this call is dispatched to, and a switch to another workspace clears it. One session holds one selection, so a new one replaces it; a selection sent for a workspace this connection has switched away from is REFUSED instead, so a card the flow moved past cannot overwrite the pinned workspace's selection.
counterparty_periods: the months the counterparties card listed, sent alongside counterparties. The pick then narrows those months only, and a month it never covered is read in full. With none named, the months this session already holds bound the pick. This never becomes the session's selected months.
ack: "connectors" or "bank" — records that the user confirmed that flow step, in the workspace this call is dispatched to. A switch to another workspace clears it, so the next workspace's card asks for its own click. An acknowledgement sent for a workspace this connection has switched away from is REFUSED instead, so a card the flow moved past cannot un-confirm the step the pinned workspace's own card recorded.
Call it with NO argument at all to pin the workspace this call itself is dispatched to — its universal workspace_id, or the only workspace the token covers. workspace_ids is the PIN write and nothing else: it moves the pin AND replaces the workspace_queue, so a one-entry list ends a run that still had workspaces queued. Send it only to change the workspace. A call carrying periods, counterparties or ack needs no workspace_ids: its universal workspace_id targets that one call, and the pin and the queue stay where they are. Never re-pin the workspace this connection already holds.
Every provided input is applied, and changed names the session fields this call wrote. After a switch, every later call that omits workspace_id targets the pinned workspace, for reads and writes alike; passing workspace_id on a later call overrides it for that call only. well_list_workspaces reports the current session context, and well_wait_for_selection reads a card click back — instantly when it already landed here, after a short wait otherwise.
This changes nothing in the user's data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ack | No | Acknowledge a flow step: "connectors" for the connect-tools step, "bank" for the bank step. The acknowledgement is scoped to the workspace this call is dispatched to, and a switch to another workspace clears it. An acknowledgement sent for a workspace this connection has switched away from is refused, and the pinned workspace's own acknowledgement of that step stands. | |
| periods | No | The months the user VALIDATED on the period card, stored as this session's selected_periods. Later period-scoped reads default to them when called without a period. This field is the user's month selection alone — to bound a counterparty pick, send counterparty_periods instead. | |
| workspace_id | No | Target 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. | |
| workspace_ids | No | Ordered workspace selection, and the ONLY field that moves the pin: the FIRST entry becomes this connection's pin, and the rest REPLACE the workspace_queue — so a one-entry list empties a queue that still holds workspaces. Every entry must be authorized for this connection, or the whole call is refused. Never send it to name the workspace of a periods, counterparties or ack call: the universal workspace_id already targets those, while a re-pin to the id this connection already holds writes nothing and clears the queue. | |
| counterparties | No | The counterparties the user selected, stored as this session's selected_counterparties and scoped to the workspace this call is dispatched to. At most 200 — a longer list is refused, so a select-all keeps to that bound. Copy the ids off the row: company_id, plus matched_connector_service_id when the row carries one. Send the card's months as counterparty_periods in the same call, so the pick applies to those months only; with none named, the months this session already holds bound it. The session holds ONE selection, so this REPLACES the previous one — but only when the call names the pinned workspace: a selection sent for a workspace this connection has switched away from is refused, and the pinned workspace's selection stands. | |
| idempotency_key | No | Optional client-supplied key. A retried write with the same key returns the original result instead of re-applying the operation. | |
| counterparty_periods | No | The months the counterparties card listed, which bound the pick sent as counterparties in the same call. Send it only with counterparties; it never becomes this session's selected months, so it cannot overwrite what the user validated on the period card. With none named, the months this session already holds bound the pick. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | ||
| changed | No | Which session fields this call wrote. | |
| success | Yes | ||
| acknowledged | No | ||
| workspace_id | No | ||
| workspace_name | No | ||
| workspace_queue | No | The workspaces queued after the pinned one, in order. | |
| selected_periods | No | ||
| selected_counterparties | No |