Merge company
well_merge_companyMerge a duplicate company into the company to keep, in the current workspace.
Use this tool when the user says a company is a duplicate of another, or asks to merge, fold or deduplicate two companies — also when they say "delete X, it's a duplicate (of Y)". Never use well_delete_company for a duplicate: a delete keeps the duplicate's invoices and contacts on a removed company, a merge moves them.
REQUIRED: company_id (the duplicate), into_company_id (the company to keep). Find both ids with well_query_records first. When the user names only the duplicate and several companies could be the one to keep, ask which one, once.
Nothing is deleted: the duplicate's invoices, contacts and other links move to the company to keep, and the duplicate stays as a removed record that points to it. Issued invoices stay on the duplicate: an issued document keeps the party it names. Two companies with different legal identifiers (SIREN, VAT) are never merged. When the duplicate is the workspace's own company, the own company is kept and the other one is merged into it: the confirmation and the result name that direction.
Returns { success: true, company_id, name, into_company_id, into_name, moved, locked_rows_kept } on success, where company_id is the company merged away and into_company_id the company kept, or { success: false, error } on failure.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| company_id | Yes | UUID of the duplicate company, the one merged away | |
| 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. | |
| 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. | |
| idempotency_key | No | Optional client-supplied key. A retried write with the same key returns the original result instead of re-applying the operation. | |
| into_company_id | Yes | UUID of the company to keep | |
| 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 |
|---|---|---|---|
| code | No | ||
| name | No | ||
| error | No | ||
| moved | No | ||
| success | Yes | ||
| into_name | No | ||
| company_id | No | ||
| reply_lines | 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. | |
| into_company_id | No | ||
| near_candidates | No | ||
| 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. | |
| locked_rows_kept | 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. | |
| near_candidates_truncated | No |