Skip to main content
Glama

rotate_token

Rotate your agent token to revoke a compromised secret and obtain a fresh one. Managed agents get a grace window for both tokens; unmanaged agents require restart.

Instructions

Self-rotate your own agent_token (v2.1).

When to use: scheduled rotation, suspected token leak, or any time you want a fresh secret without losing identity. For admin-driven rotation of someone else's token use rotate_token_admin. To wipe the token entirely use revoke_token.

Behavior: requires the current valid token. For Managed agents (registered with managed:true) the relay enters a grace window during which BOTH old and new tokens authenticate, and a priority='high' push-message carries the new token to the agent so it can self-update. For unmanaged agents (default, Claude Code terminals), the response carries restart_required:true and the old token is invalid immediately.

Returns: { success: true, agent_name, new_token, rotated_at: ISO, agent_class: 'managed' | 'unmanaged' }. Managed-with-grace adds grace_expires_at: ISO, push_sent: boolean, auth_note. Managed-with-zero-grace adds grace_expires_at: null, push_sent: false, auth_note. Unmanaged adds restart_required: true, operator_note.

Errors: NOT_FOUND (unknown agent), INVALID_STATE (auth_state ≠ active — recovery_pending / revoked / legacy_bootstrap / rotation_grace each return a state-specific hint), CONCURRENT_UPDATE (CAS race lost), INTERNAL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_nameYesAgent name — must match the token's owner
agent_tokenNoYour agent token (from register_agent response). Optional here — also resolvable from RELAY_AGENT_TOKEN env or X-Agent-Token header.
grace_secondsNov2.1 Phase 4b.2: override the grace window length for managed agents. Clamped to [0, 3600]. 0 forces hard-cut (immediate invalidation) even for managed agents. Unmanaged agents ignore this field (no grace applicable). Default: RELAY_ROTATION_GRACE_SECONDS env var (fallback 900).
Behavior5/5

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

No annotations provided, so the description carries full burden and delivers richly. Discloses prerequisite (current valid token), grace-window mechanics for managed agents (both tokens valid, push-message carries new token), immediate invalidation for unmanaged, and state-specific behavior. Documents exact return shapes for each agent class.

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?

Well-organized with clear paragraphs for when-to-use, behavior, returns, and errors. Front-loaded with the one-line purpose. Slightly lengthy but every section adds distinct information; the detail about return variants is justified for a tool with nuanced behavior.

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?

No output schema exists, so the description must document return values, and it does so exhaustively for all three agent-class variants. Also documents the error codes with state-specific handling. For a tool with this behavioral complexity (3 agent classes, grace windows, CAS races), the description is remarkably complete.

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. The description adds value by explaining grace_seconds' clamp behavior relevance and that unmanaged agents ignore it, plus alternative token resolution routes (env var, header) beyond the schema note. Slight deduction for not elaborating on agent_name semantics beyond what the schema states.

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?

Clear verb+resource+scope: 'Self-rotate your own agent_token (v2.1)'. Explicitly contrasts with siblings: distinguishes from rotate_token_admin (admin-driven rotation of others) and revoke_token (wiping entirely). Strong differentiation.

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 lists when to use (scheduled rotation, suspected leak, fresh secret without losing identity) and names specific alternatives with precise conditions (rotate_token_admin for admin-driven, revoke_token for wiping). Also details managed vs unmanaged behavior context.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Maxlumiere/bot-relay-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server