Skip to main content
Glama
gitCarrot

AWS Cognito MCP Server

by gitCarrot

reset_password_veryify_code

Verify a password reset code and set a new password for AWS Cognito users to regain account access after requesting a reset.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
newPasswordYes
usernameYes

Implementation Reference

  • Executes the tool logic: confirms the password reset code using AWS Cognito's confirmPassword method, updates password on success, returns formatted response.
    async ({ username, code, newPassword }) => { const cognitoUser = new CognitoUser({ Username: username, Pool: userPool, }); return new Promise((resolve, reject) => { cognitoUser.confirmPassword(code, newPassword, { onSuccess: () => { console.log('Password reset completed'); resolve({ content: [ { type: "text" as const, text: "Password reset successfully", }, { type: "text" as const, text: `Username: ${username}`, }, { type: "text" as const, text: `Verification code: ${code.substr(0, 2)}****${code.substr(-2)}`, }, { type: "text" as const, text: `Password length: ${newPassword.length} characters`, } ] }); }, onFailure: (err) => { console.error('Password reset failed:', err.message); reject({ content: [ { type: "text" as const, text: `Password reset failed: ${err.message}`, }, { type: "text" as const, text: `Error code: ${(err as any).code || 'Unknown'}`, } ] }); } }); }); }
  • Zod schema for input validation: requires username, verification code, and new password.
    { username: z.string(), code: z.string(), newPassword: z.string(), },
  • index.ts:336-392 (registration)
    Registers the MCP tool 'reset_password_veryify_code' with schema and handler implementation.
    server.tool( "reset_password_veryify_code", { username: z.string(), code: z.string(), newPassword: z.string(), }, async ({ username, code, newPassword }) => { const cognitoUser = new CognitoUser({ Username: username, Pool: userPool, }); return new Promise((resolve, reject) => { cognitoUser.confirmPassword(code, newPassword, { onSuccess: () => { console.log('Password reset completed'); resolve({ content: [ { type: "text" as const, text: "Password reset successfully", }, { type: "text" as const, text: `Username: ${username}`, }, { type: "text" as const, text: `Verification code: ${code.substr(0, 2)}****${code.substr(-2)}`, }, { type: "text" as const, text: `Password length: ${newPassword.length} characters`, } ] }); }, onFailure: (err) => { console.error('Password reset failed:', err.message); reject({ content: [ { type: "text" as const, text: `Password reset failed: ${err.message}`, }, { type: "text" as const, text: `Error code: ${(err as any).code || 'Unknown'}`, } ] }); } }); }); } )

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/gitCarrot/mcp-server-aws-cognito'

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