set_key_order
The CodePanel MCP tool that sets which of a provider's two keys agent runs try first. Keys are entered in the browser only, never here.
On this page›
set_key_order chooses which of a provider's two keys the agent app's model calls try first, or stops using the second. It needs the agents:write scope. The keys themselves are entered in CodePanel Settings, in the browser, and never pass through this tool or any other.
When to call it
- To spend one key before the other: a team key first, a personal key as the fallback, or the other way round.
- To stop falling back:
fallbackEnabled: falsekeeps the second key saved but unused.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
provider |
string | yes | Provider id, from get_key_status |
keyOrder |
primary_first or fallback_first |
no | |
fallbackEnabled |
boolean | no | False keeps the second key saved but unused |
It writes: the server marks it readOnlyHint: false and destructiveHint: true (it can change what is already there), so a client that asks before writes asks here.
provider comes from get_key_status. keyOrder is primary_first (the default) or fallback_first. A call the provider refuses on one key (401, 402, 403 or 429) is retried once on the other; any other answer is passed back as it is. Reviews use the first key only.
What it returns
{ before, after }, each with fallbackConfigured, fallbackStatus, keyOrder and fallbackEnabled, and never a key.
The same step without MCP
| Surface | Form |
|---|---|
| HTTP API | POST /keys/order with the agents:write scope |
| CLI | codepanel keys order <provider> [--order primary_first|fallback_first] [--fallback on|off] |
What the server tells your agent
The description your agent reads when it lists the tools:
Use it to choose which of a provider's two keys the agent app's model calls try first, or to stop using the second. Pass provider (from get_key_status) and keyOrder (primary_first or fallback_first) and/or fallbackEnabled. A call the provider refuses on one key (401, 402, 403 or 429) is retried once on the other. Keys themselves are entered in CodePanel Settings only and never pass through here. Needs the agents:write scope. Returns { before, after }.
Related
get_key_status: which providers have a key, and their second key's state.- MCP server: install, sign-in and every other tool.