resend_confirmation_code
Resend confirmation codes for AWS Cognito users who need to verify their accounts after sign-up or when codes expire.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes |
Implementation Reference
- index.ts:795-846 (handler)The handler function for the 'resend_confirmation_code' tool. It creates a CognitoUser instance for the given username and calls resendConfirmationCode to send a new confirmation code via email or other delivery method.async ({ username }) => { return new Promise((resolve, reject) => { const cognitoUser = new CognitoUser({ Username: username, Pool: userPool }); cognitoUser.resendConfirmationCode((err, result) => { if (err) { reject({ content: [ { type: "text" as const, text: `Failed to resend confirmation code: ${err.message}`, }, { type: "text" as const, text: `Error code: ${(err as any).code || 'Unknown'}`, } ] }); return; } resolve({ content: [ { type: "text" as const, text: "Confirmation code resent successfully", }, { type: "text" as const, text: `Username: ${username}`, }, { type: "text" as const, text: `Delivery method: ${result?.CodeDeliveryDetails?.DeliveryMedium || 'Unknown'}`, }, { type: "text" as const, text: `Destination: ${result?.CodeDeliveryDetails?.Destination || 'Unknown'}`, }, { type: "text" as const, text: `Time: ${new Date().toISOString()}`, } ] }); }); }); } )
- index.ts:792-794 (schema)Zod schema for input validation, requiring a 'username' string.{ username: z.string() },
- index.ts:790-791 (registration)Registration of the tool with MCP server using server.tool(), specifying name, schema, and handler.server.tool( "resend_confirmation_code",