Skip to main content
Glama

aga_rotate_keys

Rotate cryptographic keypairs for issuers, portals, or chains to maintain security by replacing old keys with new ones and revoking the previous versions.

Instructions

Rotate a keypair (issuer, portal, or chain). Old key should be revoked.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
key_typeNo
keypairNo
reasonNo

Implementation Reference

  • The handleRotateKeys function implements the logic for rotating keys in the aga_rotate_keys tool, handling different key types and updating the server context.
    export async function handleRotateKeys(args: RotateKeysArgs, ctx: ServerContext) {
      const keyType = args.key_type ?? args.keypair;
      if (!keyType) return ctx.error('Provide key_type or keypair parameter.');
    
      let result;
      switch (keyType) {
        case 'issuer':
          result = rotateKeys(ctx.issuerKP);
          (ctx as any).issuerKP = result.newKeyPair;
          break;
        case 'portal':
          result = rotateKeys(ctx.portalKP);
          (ctx as any).portalKP = result.newKeyPair;
          break;
        case 'chain':
          result = rotateKeys(ctx.chainKP);
          (ctx as any).chainKP = result.newKeyPair;
          break;
        default:
          return ctx.error(`Invalid key_type: ${keyType}. Must be issuer, portal, or chain.`);
      }
    
      await ctx.appendToChain('KEY_ROTATION', {
        key_type: keyType,
        old_public_key: result.oldPublicKeyHex,
        new_public_key: result.newPublicKeyHex,
        rotated_at: result.rotatedAt,
        reason: args.reason ?? 'Key rotation',
      });
    
      return ctx.json({
        success: true,
        key_type: keyType,
        old_public_key: result.oldPublicKeyHex,
        new_public_key: result.newPublicKeyHex,
        rotated_at: result.rotatedAt,
        reason: args.reason,
      });
    }
  • The RotateKeysArgs interface defines the expected input parameters for the aga_rotate_keys tool.
    export interface RotateKeysArgs {
      key_type?: 'issuer' | 'portal' | 'chain';
      keypair?: 'issuer' | 'portal' | 'chain';
      reason?: string;
    }
  • src/server.ts:316-324 (registration)
    The aga_rotate_keys tool is registered in src/server.ts using the governedTool function.
    governedTool('aga_rotate_keys',
      'Rotate a keypair (issuer, portal, or chain). Old key should be revoked.',
      {
        key_type: z.enum(['issuer', 'portal', 'chain']).optional(),
        keypair: z.enum(['issuer', 'portal', 'chain']).optional(),
        reason: z.string().optional(),
      },
      async (args) => handleRotateKeys(args, ctx),
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that 'old key should be revoked', hinting at a destructive operation, but fails to detail permissions needed, rate limits, or the mutation's impact. This is inadequate for a tool with security implications.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste, front-loading the core action. It is appropriately sized for the tool's complexity.

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

Completeness2/5

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

Given the tool's complexity (key rotation with security implications), no annotations, no output schema, and 0% schema coverage, the description is incomplete. It lacks details on behavior, parameters, and outcomes, making it insufficient for safe and effective use.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It does not explain the parameters 'key_type', 'keypair', or 'reason', leaving their meanings ambiguous. The mention of key types partially relates to enums but adds no semantic depth beyond the schema.

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

Purpose4/5

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

The description clearly states the action ('rotate a keypair') and specifies the resource types (issuer, portal, or chain), which distinguishes it from siblings like 'aga_revoke_artifact' or 'aga_get_chain'. However, it doesn't explicitly differentiate from all siblings, as some may involve key management indirectly.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'aga_revoke_artifact' or 'aga_get_chain', nor does it mention prerequisites or exclusions. It implies usage for key rotation but lacks context-specific advice.

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/attestedintelligence/aga-mcp-server'

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