Skip to main content
Glama

set_api_key_expiry

Destructive

Change when an API key stops working: set an end date on a key that has none, move it earlier or later, or pass expires_at null so the key never expires. The key keeps its id, secret, scopes and sub-account; only the date changes, and nothing extends it later. Answers the key as list_api_keys shows it.

Refused before any 2FA code is asked for: a key that is not one of the account's live keys (not_found); a key whose expires_at has passed (api_key_expired — it cannot be revived, create a new key instead); a key an MCP sign-in renews itself (api_key_managed_by_sign_in — list_api_keys shows managed_by_sign_in: true; the user disconnects the AI client to end it). Check list_api_keys first so you do not start 2FA for a refused change.

Agent usage: This operation requires 2FA bound to this key AND this exact value, shortening included: a code confirmed for one date does not set another date or "never". (1) Call set_api_key_expiry with the value the user chose; its 2fa_required refusal lists the exact targets — ["", "act:expires_at:<the instant as UTC ISO 8601 with milliseconds, e.g. 2027-02-09T14:59:59.999Z>"], or "act:expires_at:never" for null. (2) Call start_2fa with action_type "api_key_expiry" and exactly those targets; the user is shown the date (or "never") they are approving. (3) Wait for the user to verify the code and poll get_2fa_status until "verified". (4) Call set_api_key_expiry again with the SAME value. One code covers one change.

ACCESS: needs a Proof account, signed in: call start_login, show the user its challenge, then wait_for_login, then call this tool again. Authenticating this client alone does NOT open this tool.

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": {
      "id": "<id>",
      "expires_at": "<expires_at>"
    },
    "name": "set_api_key_expiry"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYesAPI key ID
expires_atYesThe new end date, ISO 8601 with offset, at least 5 minutes ahead — or null for a key that never expires. Ask the user rather than choosing.

Output Schema

NameRequiredDescriptionDefault
dataYesA live API key as the owner's key list shows it. Never carries the key value.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations give only readOnlyHint=false and destructiveHint=true, yet the description discloses far more: the three named refusal codes and their meanings, that an expired key cannot be revived, that only the date changes and 'nothing extends it later', and that a 2FA code is bound to one exact value so shortening counts as a change. The authentication prerequisite (start_login → wait_for_login, and that authenticating this client alone does not open the tool) is stated explicitly rather than left to discovery.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, then refusals, then a numbered procedure; paragraph breaks and the step list make it scannable. It is long, and the repeated emphasis on 'this exact value' / 'SAME value' across two sections is slightly redundant, but the length is justified by the multi-step 2FA protocol an agent must follow.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need no explanation, and the description still gives a useful pointer ('Answers the key as list_api_keys shows it'). For a two-parameter mutation gated behind 2FA and a login requirement, everything an agent needs to call it correctly — prerequisites, refusal handling, and the exact retry protocol — is present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, but the description adds real meaning: the exact 2FA target string format ('act:expires_at:<UTC ISO 8601 with milliseconds>', or 'act:expires_at:never'), which is not in the schema and is required for the call to succeed. It also reinforces that the value must be user-chosen, matching the schema hint but adding the operational reason (2FA is bound to the value).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Change when an API key stops working') and enumerates the three distinct cases: adding a date, moving it, or clearing it with null. It also states what is preserved (id, secret, scopes, sub-account), which distinguishes this from siblings like create_api_key, regenerate_api_key, and revoke_api_key.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly tells the agent to call list_api_keys first and why (to avoid starting 2FA for a refused change), and names concrete alternatives for terminal cases: 'create a new key instead' for an expired key and 'the user disconnects the AI client' for a sign-in-managed key. The numbered 2FA workflow spells out the exact sequencing with start_2fa and get_2fa_status.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.