lads_list_ad_accounts
LinkedIn Ads read low risk
Part of the LinkedIn Campaign Manager Agent.
What it does
List the LinkedIn ad accounts Claude can use, WITH NAMES: every account the user has turned ON for Claude in the Scalix dashboard. Rows are {account_urn, account_id (digits only), name, role}; name comes from the connection's account discovery (null if LinkedIn returned none, or its name lookup failed during discovery). Exact-set contract: an enabled account ALWAYS appears unless role_filter leaves it out (a warning then counts those accounts by role), and an account turned OFF for Claude never appears as a row (a warning reports how many were hidden). This is the DISCOVERED set stored at connect time; if an expected account is missing (e.g. access newly granted on LinkedIn), call again with refresh=true to re-sync — per-account ON/OFF selections are preserved. Role gates capability on LinkedIn's side: VIEWER and CREATIVE_MANAGER cannot mutate campaigns even when the token holds rw_ads. Use account_id (digits, no urn: prefix) in all child-resource paths; account_urn where a tool asks for the URN. Returns {success, data:[rows], count, warnings}.
When to use it
First call of any LinkedIn session where the target account is unknown, or whenever the user asks what accounts are available. If the user names an account you cannot see, retry once with refresh=true before concluding it is unavailable.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
role_filter | string | no | Optional filter on the member's role for the account (case-insensitive): ACCOUNT_BILLING_ADMIN, ACCOUNT_MANAGER, CAMPAIGN_MANAGER, CREATIVE_MANAGER or VIEWER. A warning counts, by role, the enabled accounts it leaves out. Omit to return all roles. |
page_size | integer | no | Cap the number of rows returned, 1 or more (a warning states how many were cut; under 1 is refused). The listing is the enabled set from account discovery; it carries no status or test flag to filter on. |
refresh | boolean | no | Default false (fast, serves the last synced set). Set true to re-run account discovery against LinkedIn right now - use when the user says an account is missing (e.g. newly granted access). Per-account ON/OFF selections are preserved. An empty account list auto-refreshes once even without this flag. |
Safeguards
Policy
Strict per-account isolation: this finder defines the exact set of accounts the bearer is authorized to touch. Never operate on, join, or pool data across any account not returned here for THIS token. Account/role data may be used only for reporting and operating on behalf of the authorizing client — never to build a cross-account or cross-client database.
Reminder
Present accounts to the user BY NAME (the id in parentheses) - never as bare URNs or numbers. If an account the user mentions is not listed, it is turned OFF in the Scalix dashboard (say so - the warning carries the hidden count), left out by role_filter (a warning counts those), or not yet synced (offer refresh=true). Each account's data stays isolated to the authorizing client.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
TOKEN_REVOKED | The LinkedIn access token is expired or revoked (401). The 60-day access token may need a programmatic refresh, or the member must re-authorize; the ~365-day refresh-token TTL does not reset on use. | needs_reauth — attempt one token refresh then retry once; if refresh fails, prompt the user to reconnect LinkedIn in the Scalix console. | yes |
PERMISSION_DENIED | Token lacks the r_ads (or rw_ads) scope required to read ad-account access (403 / out-of-bearer-scope). | Re-authorize with r_ads; do not retry without the scope. | no |
RESOURCE_EXHAUSTED | LinkedIn rate/quota limit hit (429) — application- or member-level daily call quota exceeded (each paginated call counts against the per-app daily limit). | Back off and retry with exponential delay 5/10/20s capped at 60s; honor Retry-After / X-RateLimit-Reset if present. | yes |
INVALID_ARGUMENT | page_size under 1 is refused before anything is read (the listing is the stored set, not paged on LinkedIn). | Pass page_size of 1 or more, or omit it. | no |
PLATFORM_UNAVAILABLE | LinkedIn returned a 5xx server error. | Retry with backoff (5/10/20s, cap 60s); if persistent, report the outage clearly. | yes |
Edge cases
- No accessible accounts -> success with count:0 and empty list (member simply has no ad-account roles).
- One element per account/role pair; the same person never appears twice for a single account but may hold different roles across distinct accounts.
- Test ad accounts are listed like any other: the stored set carries no test flag (lads_get_ad_account shows test: true). A test account never serves and has no analytics.
- No paging: the listing is the stored set from account discovery, returned whole in one call; page_size only caps the rows, and a warning says how many were cut.
- Each row carries the member's role. VIEWER and CREATIVE_MANAGER cannot change campaigns: LinkedIn refuses those writes (403) at commit, and the Scalix write tools do not check the role at preview, so check it before proposing a change.
- Expired token -> single refresh + retry once before surfacing needs_reauth.
- The stored set carries no account status: an account LinkedIn holds as PENDING_DELETION or REMOVED is listed like any other; lads_get_ad_account shows its status.
- If LinkedIn's account-name lookup fails during discovery, every account is still listed, with name null; no warning names that failure.