Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions skills/stackone-connection/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ If this session has no connector-profile or account-linking tools (such as `stac
Find the thing before you touch it, and stop if it is already right.

- A profile: `stackone_get_connector_profiles {connector_key: ["<provider>"]}`, or `stackone_get_connector_profiles {id}` for one profile. `connector_key` is a list.
- An account: `stackone_list_linked_accounts {providers}` or `stackone_get_account {id}`.
- An account: `stackone_get_accounts {connector_key: ["<provider>"], expand: "connector,connector_profile"}`, or
`stackone_get_accounts {id, expand: "connector,connector_profile"}` for one account.

If the account is already linked and authenticated, or the profile already enables the action, say
so and change nothing.
Expand All @@ -43,32 +44,36 @@ stackone_link_account { connector_profile_id: "<the profile's id>", label: "Prod
`stackone_link_account` returns the auth link synchronously, but the account exists only after the
user finishes in the browser. There is no status-poll tool.

1. `stackone_link_account { connector_profile_id | provider }` returns
1. Before starting the link, read `stackone_get_accounts {connector_key: ["<provider>"]}` and note
the account ids it returns.
2. `stackone_link_account { connector_profile_id | provider }` returns
`{ auth_link_url, expires_at, provider, connector_profile_id, next_steps }`. Give the user the
`auth_link_url` to open and relay `next_steps`.
2. When the user says they are done, confirm the account exists with a read:
`stackone_list_linked_accounts` or `stackone_get_account` returns the new account. Confirm
success from that read, never from the fact that you started the link.
3. When the user says they are done, run the same read again. The new account is the id that was
not in the first read. Confirm success from that new id, never from the fact that you started
the link or from an account that was already there.

## Reconnect a broken account; do not replace it

`stackone_link_account` has no `account_id` input, and this surface has no separate repair or
edit-mode tool. You reconnect an expired or deauthorized account by starting a fresh link through
the same connector profile the account already uses, then confirming by re-reading the account.
How you reconnect an expired or deauthorized account depends on the tools this session has. A
repair tool brings the same account back; a fresh link adds a new account beside the broken one.

- Read the broken account with `stackone_get_account {id}`. Its output names the provider and the
profile (`integration_config_labels`), but not the profile id.
- Look the profile up with `stackone_get_connector_profiles {connector_key: ["<the account's
provider>"]}` and match it by name to get its `id`.
- Relink through that profile:
- Read the broken account with `stackone_get_accounts {id, expand: "connector,connector_profile"}`.
Its `connector_profile_id` is the profile it links through. When that is null, choose the profile
as in "Pick the profile deliberately" above.
- If the session has a tool that reconnects or repairs an existing account by its id (for example
`stackone_relink_account`), use it on the broken account's `id`.
- Only when no such tool exists, start a fresh link through the profile the account already uses.
`stackone_link_account` has no `account_id` input, so it creates a new account through that
profile and leaves the broken one as it is:

```
stackone_link_account { connector_profile_id: "<the broken account's profile id>" }
```

Do not delete the old account first, and do not start a bare `provider` link when more than one
profile exists for the connector. Confirm the repair by re-reading the account and checking its
status.
profile exists for the connector. Confirm the repair by re-reading the account (after a fresh link,
the new one) and checking its status.

## Diagnose a new or suspect link from evidence

Expand Down