Link datasource to client
link_datasourcePoint a client at one of the account's datasource connections — the connect panel's account picker, as a tool. Call it with just client_id + datasource_id to see the choices, then again with the id you picked. It lists the connections first when there is more than one for the datasource. Three shapes, decided by the datasource: ones with no accounts (Stripe, Shopify, Klaviyo…) link immediately; most take one pick; six take two — Google Ads and Local Services Ads (manager then customer), Meta and Instagram Ads (business then ad account), GA4 (account then property), Business Profile (account then one or more locations). For those, pass the first pick as account_id and the second as sub_account_ids. Linking re-fetches the client's widgets on that datasource in the background — get_widget_data reads them as they land.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client_id | Yes | Client to link (from list_clients) | |
| account_id | No | The account to link — or, for a two-step datasource, the container to look inside. Omit to list the choices | |
| manual_value | No | For a datasource that is told what to report on instead of offering a list — Ahrefs takes a domain. Call without it and the tool names the value it wants | |
| datasource_id | Yes | Datasource alias (from datasources) | |
| connection_name | No | Which connection to use. Omit it: with one connection for this datasource the tool uses it, with several it lists them | |
| sub_account_ids | No | Two-step datasources only: what to link inside account_id (Business Profile takes several locations; the rest take one) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | Either the link that was made, or — when the call was ambiguous — the choices to pick from: the connections for this datasource, or the accounts inside one. Ask the user which, then call again naming it. | |
| success | Yes | True when the call succeeded. A failure comes back as an error result instead. |