Skip to main content
Glama
getpara
by getpara

wait_for_wallet_ready

Poll a wallet until MPC key generation completes, checking every 2 seconds up to a configurable maximum wait time.

Instructions

Poll a wallet until its status becomes "ready" (MPC key generation complete). Polls every 2 seconds up to a configurable max wait time (default 30s).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletIdYesThe wallet ID to poll
maxWaitMsNoMaximum time to wait in milliseconds (default 30000)

Implementation Reference

  • The handler function implements the polling logic to check the status of a wallet until it is 'ready', 'error', or times out.
    export async function handler(client: ParaClient, args: Record<string, unknown>) {
      const walletId = args.walletId as string;
      const maxWaitMs = (args.maxWaitMs as number) ?? 30_000;
      const pollIntervalMs = 2_000;
    
      const start = Date.now();
    
      while (Date.now() - start < maxWaitMs) {
        const wallet = await client.requestWithRetry<Wallet>(`/v1/wallets/${walletId}`);
    
        if (wallet.status === 'ready') {
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify(
                  { ...wallet, _note: 'Wallet is ready. You can now use sign_raw to sign data.' },
                  null,
                  2,
                ),
              },
            ],
          };
        }
    
        if (wallet.status === 'error') {
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify(
                  { ...wallet, _note: 'Wallet creation failed. Try creating a new wallet.' },
                  null,
                  2,
                ),
              },
            ],
            isError: true,
          };
        }
    
        await new Promise((r) => setTimeout(r, pollIntervalMs));
      }
    
      return {
        content: [
          {
            type: 'text' as const,
            text: `Wallet ${walletId} did not become ready within ${maxWaitMs}ms. Current status is still "creating". You can call wait_for_wallet_ready again to keep polling.`,
          },
        ],
        isError: true,
      };
    }
  • The definition object contains the name, description, and input schema for the 'wait_for_wallet_ready' tool.
    export const definition = {
      name: 'wait_for_wallet_ready',
      description:
        'Poll a wallet until its status becomes "ready" (MPC key generation complete). Polls every 2 seconds up to a configurable max wait time (default 30s).',
      inputSchema: {
        type: 'object' as const,
        properties: {
          walletId: {
            type: 'string',
            description: 'The wallet ID to poll',
          },
          maxWaitMs: {
            type: 'number',
            description: 'Maximum time to wait in milliseconds (default 30000)',
          },
        },
        required: ['walletId'],
      },
    };

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/getpara/para-wallet-mcp'

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