Rotate an app's service token
rotate_app_tokenGive a private app's service token a new value without an outage, and write the new value straight into each caller's secret env var. Each caller restarts to read it. The old value keeps working for a fixed overlap (20 minutes by default), so callers move over before it stops; the answer says when. The value never passes through this conversation. deliver_to names the callers, apps or agents in the same organization; omit it to deliver to the callers the token's earlier rotations recorded, which list_app_tokens shows. A rotation with no caller to deliver to is refused here, because its value would have to be shown: run valet apps token rotate in a terminal for a token used outside Valet. A token rotates again only after its old value stops working; a repeat before then is refused, so a retried call never rotates twice. A token that does not exist yet is minted. Requires connecting a Valet account. Requires the Admin role.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>",
"token": "<token>"
},
"name": "rotate_app_token"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The app's name, as list_services shows it: the app whose tokens these are. | |
| token | Yes | The token's name, as list_app_tokens shows it. | |
| org_name | No | The Valet organization it belongs to. Omit to use the organization the account joined first. | |
| deliver_to | No | The callers to write the new value into. Omit to use the callers the token recorded. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | The app whose token rotated. | |
| org | Yes | Name of the Valet organization the call acted in. | |
| token | Yes | The token's name. | |
| deliveries | Yes | What happened at each caller. | |
| retiring_until | No | When the old value stops working, RFC 3339. Absent when the rotation minted the token's first value. |