reset_mailbox_password
Reset mailbox passwords for Migadu email accounts by specifying the target email and providing a new password. Handle password updates efficiently with this tool.
Instructions
Reset mailbox passwords. List of dicts with: target (email/local), new_password (required).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resets | Yes |
Implementation Reference
- MCP tool handler function implementing bulk mailbox password resets using the bulk processor helper.@mcp.tool( annotations={ "readOnlyHint": False, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True, }, ) async def reset_mailbox_password( resets: List[Dict[str, Any]], ctx: Context ) -> Dict[str, Any]: """Reset mailbox passwords. List of dicts with: target (email/local), new_password (required).""" count = len(list(ensure_iterable(resets))) await log_bulk_operation_start(ctx, "Resetting passwords for", count, "mailbox") result = await process_reset_password(resets, ctx) await log_bulk_operation_result(ctx, "Password reset", result, "mailbox") return result
- migadu_mcp/utils/schemas.py:125-130 (schema)Pydantic input schema model for validating password reset requests used by the bulk processor.class MailboxPasswordResetRequest(BaseModel): """Request schema for resetting mailbox password""" target: str = Field(..., description="Email address or local part") new_password: str = Field(..., description="New password for authentication")
- Bulk processing helper that validates individual reset requests and invokes the mailbox service API call.@bulk_processor_with_schema(MailboxPasswordResetRequest) async def process_reset_password( validated_item: MailboxPasswordResetRequest, ctx: Context ) -> Dict[str, Any]: """Process a single password reset with Pydantic validation""" # Use validated Pydantic model directly - all validation already done target = validated_item.target new_password = validated_item.new_password # Parse target parsed = parse_email_target(target) domain, local_part = parsed[0] email_address = format_email_address(domain, local_part) await log_operation_start(ctx, "Resetting password", email_address) service = get_service_factory().mailbox_service() await service.reset_mailbox_password(domain, local_part, new_password) await log_operation_success(ctx, "Reset password", email_address) return {"reset": email_address, "success": True}
- Service method performing the actual Migadu API PUT request to update the mailbox password.async def reset_mailbox_password( self, domain: str, local_part: str, new_password: str ) -> Dict[str, Any]: """Reset mailbox password""" data = {"password": new_password} return await self.client.request( "PUT", f"/domains/{domain}/mailboxes/{local_part}", json=data )
- migadu_mcp/tools/mailbox_tools.py:31-31 (registration)Registration function that defines and registers all mailbox tools including reset_mailbox_password when called with the MCP instance.def register_mailbox_tools(mcp: FastMCP):