affine_change_password
Update user password securely using a reset token received via email. Provide the token, user ID, and new password to complete the process.
Instructions
Change user password (requires token from email).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| newPassword | Yes | New password | |
| token | Yes | Password reset token from email | |
| userId | No | User ID |
Implementation Reference
- src/tools/userCRUD.ts:141-159 (handler)The asynchronous handler function that performs the GraphQL mutation to change the user's password using a reset token and new password.const changePasswordHandler = async ({ token, newPassword, userId }: { token: string; newPassword: string; userId?: string }) => { try { const mutation = ` mutation ChangePassword($token: String!, $newPassword: String!, $userId: String) { changePassword(token: $token, newPassword: $newPassword, userId: $userId) } `; const data = await gql.request<{ changePassword: boolean }>(mutation, { token, newPassword, userId }); return text({ success: data.changePassword, message: "Password changed successfully" }); } catch (error: any) { return text({ error: error.message }); } };
- src/tools/userCRUD.ts:160-172 (registration)Registration of the 'affine_change_password' tool using server.registerTool, including title, description, Zod input schema, and handler reference.server.registerTool( "affine_change_password", { title: "Change Password", description: "Change user password (requires token from email).", inputSchema: { token: z.string().describe("Password reset token from email"), newPassword: z.string().describe("New password"), userId: z.string().optional().describe("User ID") } }, changePasswordHandler as any );
- src/tools/userCRUD.ts:162-169 (schema)Input schema definition using Zod for the tool's parameters: token, newPassword, and optional userId.{ title: "Change Password", description: "Change user password (requires token from email).", inputSchema: { token: z.string().describe("Password reset token from email"), newPassword: z.string().describe("New password"), userId: z.string().optional().describe("User ID") }