Skip to main content
Glama

recover_account

Regain access to your Lightning Wallet MCP operator account using your recovery code. This process issues a new API key and initiates a 60-minute withdrawal cooldown period.

Instructions

Recover an operator account using the recovery code from registration. Returns a new API key. Triggers 60-min withdrawal cooldown.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recovery_codeYesRecovery code from registration

Implementation Reference

  • Implementation of the account recovery logic using an API call to the Lightning Faucet server.
    async recoverAccount(recoveryCode: string): Promise<{
      operatorId: number;
      apiKey: string;
      cooldownUntil?: string;
      rawResponse: ApiResponse;
    }> {
      // Recovery doesn't need auth, so we make a direct request
      const response = await fetch(API_BASE_URL, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({
          action: 'recover',
          recovery_code: recoveryCode,
        }),
      });
    
      if (!response.ok) {
        throw new Error(`Request failed (HTTP ${response.status})`);
      }
    
      const result = await response.json() as ApiResponse & {
        operator_id?: number;
        api_key?: string;
        cooldown_until?: string;
      };
    
      if (!result.success) {
        throw new Error(result.error || 'Recovery failed');
      }
    
      return {
        operatorId: result.operator_id || 0,
        apiKey: result.api_key || '',
        cooldownUntil: result.cooldown_until,
        rawResponse: result,
      };
    }
  • MCP tool handler for the 'recover_account' tool.
    case 'recover_account': {
      const parsed = RecoverAccountSchema.parse(args);
      // Recovery doesn't need an existing API key — recoverAccount() uses its own fetch
      const tempClient = session.getClient() || new LightningFaucetClient('recovery-placeholder');
      const result = await tempClient.recoverAccount(parsed.recovery_code);
      // Auto-switch to the new key
      session.setClient(new LightningFaucetClient(result.apiKey));
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: 'Account recovered successfully. New API key is now active. Withdrawals blocked for 60 minutes.',
              operator_id: result.operatorId,
              new_api_key: result.apiKey,
              cooldown_until: result.cooldownUntil,
            }, null, 2),
          },
        ],
      };
    }
  • Zod schema for input validation of the recover_account tool.
    const RecoverAccountSchema = z.object({
      recovery_code: z.string().min(16, 'Recovery code is too short').max(64, 'Recovery code is too long')
        .describe('Recovery code received during registration'),
    });
  • src/index.ts:585-594 (registration)
    Tool registration definition for 'recover_account'.
      name: 'recover_account',
      description: 'Recover an operator account using the recovery code from registration. Returns a new API key. Triggers 60-min withdrawal cooldown.',
      inputSchema: {
        type: 'object',
        properties: {
          recovery_code: { type: 'string', description: 'Recovery code from registration' },
        },
        required: ['recovery_code'],
      },
    },
Behavior4/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 effectively describes key behaviors: it returns a new API key and triggers a 60-minute withdrawal cooldown. However, it does not mention potential side effects like invalidating old keys or requiring specific permissions, leaving some gaps.

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 extremely concise and front-loaded, consisting of just two sentences that efficiently convey the purpose, input, output, and a critical side effect. Every word earns its place with no redundancy or fluff.

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

Completeness4/5

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

Given the tool's complexity (account recovery with side effects), no annotations, and no output schema, the description is mostly complete. It covers the action, input, output, and a key behavioral constraint (cooldown), but lacks details on error conditions or the format of the returned API key.

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

Parameters3/5

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

The input schema has 100% description coverage, with the parameter 'recovery_code' fully documented in the schema. The description adds no additional semantic information about the parameter beyond what the schema provides, so it meets the baseline score of 3.

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?

The description clearly states the specific action ('Recover an operator account'), the required resource ('using the recovery code from registration'), and the outcome ('Returns a new API key'). It distinguishes itself from siblings like 'register_operator' (initial registration) and 'rotate_api_key' (key rotation without recovery).

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

Usage Guidelines4/5

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

The description implicitly indicates when to use this tool: when an operator needs to recover their account using a recovery code. However, it does not explicitly state when NOT to use it (e.g., for initial registration or key rotation) or name alternatives like 'register_operator' or 'rotate_api_key', though the context is clear.

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/lightningfaucet/lightning-wallet-mcp'

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